Javascript: why does eval ("023") return 19? [duplicate]

5

I know that the function should not be used indiscriminately, because it has several security implications, as can be seen here:

Is Eval a Good Guy or a Bandit?

But I was doing a simple calculator, where the text of the input, after treated, is passed to the eval function and returns the result. However, by entering 023 and pressing equal (equivalent to passing the string in the input to the eval function) I was surprised by the result 19.

I opened the Chrome console and typed the code:

eval("023")

And I got the following result:

19

Why is the result of executing the above line 19?

    
asked by anonymous 28.03.2017 / 19:04

0 answers