I'm fairly new to Javascript and not clear what is wrong with the code below. Basically I want to ask user to input a text string and compare to another text string. Then tell them whether their string is alphabetically higher or lower then the stored value. The code is below. When I test this in jsfiddle I only get the second alert message. any ideas?
var string1;
var string2;
string1 = prompt("tell me your string1?");
string2 = "green";
if ("string1" > "string2")
alert("your string is alphabetically higher");
else
alert ("your string is not alphabetically higher");
Aucun commentaire:
Enregistrer un commentaire