Returns the arithmetic double of the input number, or throws if not a number
The input value to be doubled
The doubled value
This will work:
console.log( double(3) ); // should print "6" Copy
console.log( double(3) ); // should print "6"
This will throw:
console.log( double('three') ); // should explode Copy
console.log( double('three') ); // should explode
Introduced in v0.3.0, Mar 22 2026
John Haugeland
TypeError if typeof x !== 'number'
typeof x !== 'number'
Returns the arithmetic double of the input number, or throws if not a number