+ 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 odpowiedzi
+ 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