Friday, February 16, 2018

Use a leading plus sign in TypeScript to cast a string to a number quickly without a parse operation.

let foo: string = "13";
let bar: number = +foo * 13;
alert(bar);

No comments:

Post a Comment