0

i defined var x = 0704 ; and the o/p was 452 .can some one explain why

is there some limit to var

18th Apr 2017, 5:22 PM
vineet pokhriyal
vineet pokhriyal - avatar
11 odpowiedzi
+ 9
Because that's how you define an octal in JS, it starts with 0.
18th Apr 2017, 5:33 PM
Karl T.
Karl T. - avatar
+ 9
This is octal system, 0704 = 8×8×7 + 4 = 452.
18th Apr 2017, 5:25 PM
Karl T.
Karl T. - avatar
+ 9
I don't know really, HEX (base 16) can be used for memory addresses but octal I'm not sure I never used it.
18th Apr 2017, 5:51 PM
Karl T.
Karl T. - avatar
+ 8
Octal number system is based on the number 8. Starting from the right you have 4×8^0 which is 4, then the second number is 0, which is 0×8^1 = 0. Third number is 7, so it is 7×8^2. You add them all up and you get 452...
18th Apr 2017, 5:30 PM
Karl T.
Karl T. - avatar
+ 8
No, any number that starts with 0. Like 0704, or 071111 or whatever.
18th Apr 2017, 5:44 PM
Karl T.
Karl T. - avatar
0
please dumb down the answer for me i dnt get it
18th Apr 2017, 5:27 PM
vineet pokhriyal
vineet pokhriyal - avatar
0
ooh. gawd thanks great help but how did you came to know its an octal system not the decimal system
18th Apr 2017, 5:32 PM
vineet pokhriyal
vineet pokhriyal - avatar
0
any four digit number will be cosidered as octal system is this what u r saying
18th Apr 2017, 5:42 PM
vineet pokhriyal
vineet pokhriyal - avatar
0
now i got you thankz
18th Apr 2017, 5:44 PM
vineet pokhriyal
vineet pokhriyal - avatar
0
but how does octal systm help ?
18th Apr 2017, 5:45 PM
vineet pokhriyal
vineet pokhriyal - avatar
0
cool
18th Apr 2017, 5:52 PM
vineet pokhriyal
vineet pokhriyal - avatar