parseInt:各种进制

2017-06-14 16:04:00
admin
原创
436
<!DOCTYPE html>
<html>
	<head>
		<title>
			Number Example 7
		</title>
		<script type="text/javascript">
			var num1 = parseInt("10", 2); //2 parsed as binary
			var num2 = parseInt("10", 8); //8 parsed as octal
			var num3 = parseInt("10", 10); //10 parsed as decimal
			var num4 = parseInt("10", 16); //16 parsed as hexadecimal
			alert(num1);
			alert(num2);
			alert(num3);
			alert(num4);
		</script>
	</head>
	<body>
	</body>
</html>
  • QQ讨论群
  • 关注微信
    • 欢迎咨询
    • 欢迎加入QQ群 16506021
  • 公众号:源宝网络