News for hackers. Stuff that matters.
Re:<3 Deno by benatkin on Sunday February 12, 2023 @06:25PM (#34768291)
or just this:

  ['10', '10', '10'].map(val => parseInt(val))
Leading zeroes can often be considered invalid input, and you may be able to safely assume that it has been dealt with already.

Also the parens around a single argument of an arrow function are a superstitious thing suggested by some well-known react developer a while back, I think.

Re:<3 Deno by contextnavidad on Sunday February 12, 2023 @06:33PM (#34768357)
I have my linting setup to force a base on `parseInt`, for the extra characters I do feel it's worth it for the safety.

The extra parentheses is just habit from Prettier formatting :)

Re:<3 Deno by benatkin on Sunday February 12, 2023 @07:04PM (#34768563)
Re:<3 Deno by jakear on Sunday February 12, 2023 @07:49PM (#34768848)
Also, no reason to write extra characters just to prevent people from using hexadecimal, it's often convenient and it comes for free!
Re:<3 Deno by mseepgood on Sunday February 12, 2023 @09:39PM (#34769544)
Octal is more sneaky than hexadecimal, especially if the values are from user input.

['07', '08', '09'].map(val => parseInt(val)) // => [7, 0, 0]

Re:<3 Deno by benatkin on Sunday February 12, 2023 @09:42PM (#34769567)
was

['07', '08', '09'].map(val => parseInt(val)) // => [7, 8, 9]

Re:<3 Deno by jakear on Sunday February 12, 2023 @10:00PM (#34769669)
Re:<3 Deno by benatkin on Sunday February 12, 2023 @11:37PM (#34770171)
Plus there's this if you really want to support old browsers: https://github.com/zloirock/core-js/blob/ce52fdc735c5c809c9e...