parseInt

2017-06-14 15:48:00
admin
原创
554
<!DOCTYPE html>
<html>
	<head>
		<title>
			Number Example 5
		</title>
		<script type="text/javascript">
			var num1 = parseInt("1234blue"); //1234
			var num2 = parseInt(""); //NaN
			var num3 = parseInt("0xA"); //10 - hexadecimal
			var num4 = parseInt(22.5); //22
			var num5 = parseInt("70"); //70 - decimal
			var num6 = parseInt("0xf"); //15 hexadecimal
			alert(num1);
			alert(num2);
			alert(num3);
			alert(num4);
			alert(num5);
			alert(num6);
		</script>
	</head>
	<body>
	</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络