string to int html code example Example: how to convert string to int js let string = "1"; let num = parseInt(string); //num will equal 1 as a int