0

Need help to find errors (javascript)

https://code.sololearn.com/WUspQg2lh8Vx/?ref=app With this code I wanted to make the name of a person , but I can't. To do that I wanted to use the command prompt() where you have to put the first letter, than the second, than the third... and at the end the name is composed. It isn't complete yet, but for now it works only for my abbreviated name(Anto). The problem is that even if I put if(firstLetter = "a") {document.write("A")} else {alert(error)} it write A even if I write B or C.. Can anyone explain?

22nd Aug 2017, 5:18 PM
antonio angelo
antonio angelo - avatar
3 Answers
+ 1
i dont really get what you mean (and i havnt read your code) but in the if statement you wrote here you would need two equal signs (==) for comparing rather than one which is for asigning variables.
22nd Aug 2017, 5:25 PM
Enzo
Enzo - avatar
0
Thanks already and sorry for bad english (I am italian)
22nd Aug 2017, 5:19 PM
antonio angelo
antonio angelo - avatar
0
Ahhh, thank you! Sorry but I had never really understande the difference between = and ==, neither looking other code. I think I miss that lesson...
22nd Aug 2017, 5:38 PM
antonio angelo
antonio angelo - avatar