var userInput = prompt();
var alice = String(userInput);
var bob = String(userInput);
if(userInput == alice || bob){
console.log("It is nice to meet you " + userInput);
} else {
console.log("You are neither alice or bob ");
}
编写一个程序来提示用户输入名称,并且仅当用户是Alice或Bob时才打招呼。
答案 0 :(得分:0)
这应该对您有用:
var userInput = prompt();
var alice = 'alice';
var bob = 'bob';
if(userInput == alice || userInput == bob) {
console.log("It is nice to meet you " + userInput);
} else {
console.log("You are neither alice nor bob");
}