+ 2
Why the output of this program is wrong? 😵😵Help.
I was writing a program. I created an array of numbers. I used to output first value of array in console.log. But the output is wrong. Can you dicuss me why the output value is wrong. The code is let n = [0234]; console.log(n[0]); //156 (Sorry for bad English) https://code.sololearn.com/WPA0V0emne0K/?ref=app
1 ответ
+ 3
If you had put commas (,) into your array, it would have output 0. Because you forgot the commas, 0234 leads with a 0, which denotes an octal number. 234 is 2 x (8 x 8) + 3 x 8 + 4 = 156