mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-06 08:23:19 +08:00
8 lines
506 B
TypeScript
8 lines
506 B
TypeScript
// Number.parseFloat / Number.parseInt ARE the global parsers (the spec
|
|
// aliases them): over string arguments they compile to the same static
|
|
// parse, compared against Node.
|
|
console.log(Number.parseFloat("3.14"), Number.parseFloat("2e3"), Number.parseFloat(" -7.5abc"));
|
|
console.log(Number.parseFloat("x"), Number.parseFloat("Infinity"));
|
|
console.log(Number.parseInt("42", 10), Number.parseInt("ff", 16), Number.parseInt("0x1f", 16));
|
|
console.log(Number.parseInt("x", 10), Number.parseInt("-101", 2));
|