mardi 21 janvier 2020

How to make a js code which allows user to view their page only if they satisfy the 'if' condition?

This is the sample code:

var users = ["ownersName","Others"];
var name=prompt("Enter your name");
if(name==users[0]){
    w
    alert("Hey"+' '+name)
    alert("You have been granted the webMaster Role!")
}
else{
    console.log("hello user");
}

I want to allow the user to view the page only if his name satisfies 'ownersName'.

Aucun commentaire:

Enregistrer un commentaire