GitHub 6248★

Convert a string to number

JavaScript version

const toNumber = (str) => +str;

TypeScript version

const toNumber = (str: string): number => +str;

Examples

toNumber('42'); // 42
Follow me on and to get more useful contents.