0
Heads up! 10 * '5' or '10' * '5' will give the same result. But trying to multiply a number with string values that aren’t numb
From the question or statement made in the notes, what if we define or assign a string a value and then use that variable to compute an expression. Var x = 5; Var y = x + 6; document.write(y); My question is, would the code computer or give an error?
1 Réponse
+ 2
10 * '5'
Here '5' will be converted into Number. If succeeded, the conversion result (Number 5) will be multiplied by 10.
'10' * '5'
Here both will be converted to Number. If succeeded they both will be multiplied.
If either one was not convertible to Number you get NaN (Not a Number)
P.S. Please add Javascript in tags ☝