+ 5
Why the name in this code get "undefined" value?
The "cost" value is fine, but wy the "name" value get undefined? https://code.sololearn.com/WPzaEty7T6QG/?ref=app
3 Answers
+ 8
Itâs because Iâm pretty sure name is already a variable. So if you change ths id of the input to Name, and change name to Name in the JS, it should work. BTW in the name input, it says type"text" instead of type="text".
+ 5
Thanks a lot Rowsej! I dont know name is a variableđ
And thanks for the input!đ
+ 2
name is an empty string.
Try
console.log(typeof(name))
console.log(name==='')
to check