Octal literals error occuring

Can we use numbers which starts from 0 like 05,06? Because I use number 05 I get following error

SyntaxError: unknown: Legacy octal literals are not allowed in strict mode (5:27)

** 3 | **
** 4 | // Only change code below this line.**
> 5 | var myArray = [“Shailesh”, 05];
** | ^**
** 6 |**

Welcome shailesh.

Your best bet would be to store those kinds of numbers as strings. That is:

var myArray = ["Shailesh","05"];

I hope this helps.

Here is some more info from MDN.

Valid octal numbers

Use a leading zero followed by the letter “o” or “O”:

0o3;

For octal escape sequences, you can use hexadecimal escape sequences instead:

'\xA9';

1 Like

Hello Sky2020,
Thanks for your suggestion.

Hi lasjorg,
Thanks for your suggestion.
I will use this steps to store ocal literals and let you know…