javascript typecasting int string code example Example 1: convert a string to number in javascript var x = Number("1000") Example 2: javascript to number parseInt("1")