-7

In my code, "SiAff" won't be the correct answer... I want to use ".toLowerCase" and ".toUpperCase", but I don't know how to do that. Any help would be appreciate

var Que = prompt("What's my name")

if (Que == "Siaff") {
    document.write("Correct!")
}

else {
    document.write("Wrong!")
}
Siaff
  • 11
  • 1
  • 3
    `Que.toLowerCase() == 'siaff'`…?! – deceze Sep 04 '17 at 11:55
  • What do you want to achieve? What is the code supposed to do? – Cerbrus Sep 04 '17 at 11:55
  • Welcome to SO. Please visit the [help] to see what and how to ask. HINT: Show effort - for example google mdn toLowerCase to read how to use toLowerCase - or this: https://www.google.nl/search?q=how+to+compare+strings+case+insensitive+javascript which [returns the duplicate](https://stackoverflow.com/questions/2140627/javascript-case-insensitive-string-comparison) as one of the first – mplungjan Sep 04 '17 at 12:00
  • Looking at the description and code OP only wants capitalized name to be correct.. https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript – yezzz Sep 04 '17 at 12:07

1 Answers1

1

Try like this Que.toLowerCase()

var Que = prompt("What's my name")

if (Que.toLowerCase() === "siaff") {
    document.write("Correct!")
}

else {
    document.write("Wrong!")
}
prasanth
  • 22,145
  • 4
  • 29
  • 53