+ 2
Whats: var a = "b" - 8 ?
Asciicode?
4 Respostas
+ 3
In your second example you get 1052.
"10" + 5 --> add 5 to the String
//105
3 - "1" --> //do the math
//3 - 1 = 2
a + b --> a connected string
//"105" + 2 = "1052"
+ 2
Output: NaN
You need charCodeAt() to get the ascii value.
var a = "b";
document.write(a.charCodeAt(a)); //98
//calc with ascii value
var a = "b";
var b = a.charCodeAt(a) - 8;
document.write(b); //90
+ 2
thanks.
but i dont understand why there are so many challenges with multiplacation of those code examples.
For example:
var a = "10" + 5;
var b = 3 - "1";
alert (a + b);
i mean yes, i know that the plus stands for string addition, but the answer of this code example (in this kind in a challenge) was only one number.
I am confused. Shitty Javascript or quiz maker...
+ 2
okay thats interesting
so if b would be 3 - "32"
// = 29?
that makes no sense for me
or is it because of the minus?