Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid number: number in octal form #484

Closed
grunjol opened this issue Apr 6, 2016 · 6 comments

Comments

@grunjol
Copy link

commented Apr 6, 2016

the same way you write 0xFF as hexadecimal (and it validates), should standard allow 0755 be a valid number in octal representation?

In webtorrent/webtorrent-desktop#326 ended up using parseInt('0755',8)

@LinusU

This comment has been minimized.

Copy link
Member

commented Apr 6, 2016

iirc there is some inconsistency between runtimes so it's better to just not use it...

@feross

This comment has been minimized.

Copy link
Member

commented Apr 7, 2016

@mafintosh Do you remember the simple way to use octals that we came up with?

@feross

This comment has been minimized.

Copy link
Member

commented Apr 7, 2016

@grunjol You can actually prefix the number with 0o and it will be treated as octal in ES6.

    > 0xFF // ES5: hexadecimal
    255
    > 0b11 // ES6: binary
    3
    > 0o10 // ES6: octal
    8

We can use ES6 freely in WebTorrent Desktop since it's an Electron app and there's no old browsers to worry about :)

@grunjol

This comment has been minimized.

Copy link
Author

commented Apr 7, 2016

great!

@feross feross closed this Apr 7, 2016

@mafintosh

This comment has been minimized.

Copy link
Contributor

commented Apr 7, 2016

@feross

This comment has been minimized.

Copy link
Member

commented Apr 11, 2016

@mafintosh right!

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.