Copy the code code as follows:
<html>
<head>
<title>parseInt() method of global object</title>
<script>
/*
The parseInt() function parses a string and returns an integer.
1. Parse the string until it cannot be parsed.
2. During hexadecimal conversion, parse the string until it cannot be parsed.
*/
document.write(parseInt("123") + "<br/>");//123
document.write(parseInt("1abc23") + "<br/>");//1
document.write(parseInt("123abc") + "<br/>");//123
document.write(parseInt("abc") + "<br/>");//NaN
document.write(parseInt("100",2) + "<br/>");//4, parsed in binary form
document.write(parseInt("123",2));//1, because 2 and 3 cannot be parsed
</script>
</head>
<body>
<div id="time"></div>
</body>
</html>