Explain please ^_^ | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Explain please ^_^

Why NaN, isn't suppose to be undefined? https://code.sololearn.com/WqB7lKZq10jv/?ref=app

16th May 2019, 5:20 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar
5 Réponses
+ 9
Because JavaScript in operations cast automatically the not defined or the var type , and in your case the last variable it's not a number
16th May 2019, 5:28 PM
Why So Serious ?
Why So Serious ? - avatar
+ 7
z is defined as a var but not initialized so your code will never throw undefined and NaN (not a number ) is usually indicate an error condition for a function that should return a valid number
16th May 2019, 5:48 PM
Why So Serious ?
Why So Serious ? - avatar
+ 1
Why So Serious ? It's because of result 30undefined as string?Means NaN? Because string converts to NaN when math operations is executed, right?
16th May 2019, 5:38 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar
+ 1
In very simple language, i will ask you , where is z kid https://code.sololearn.com/W3vok4QcCpId/?ref=app
16th May 2019, 5:58 PM
Bug Slayer
0
😵PSYCHØ CØDER😵 I understand, but it's doesn't answer me at all. Number*Number*undefined means NaN. I didn't get it.
16th May 2019, 5:36 PM
Vladyslav Semeniuk 🐸
Vladyslav Semeniuk 🐸 - avatar