时间:2021-07-01 10:21:17 帮助过:3人阅读
<script language="javascript"> var str = '100'; var num = Number(100); alert(typeof(num) + ': ' + num); var obj = Object(str); alert(typeof(obj) + ': ' + obj); var bool = Boolean(str); alert(typeof(bool) + ': ' + bool); var num = 100; var str = String(num); alert(typeof(str) + ': ' + str); var bool = Boolean(num); alert(typeof(bool) + ': ' + bool); var obj = Object(num); alert(typeof(obj) + ': ' + obj); var bool = true; var str = String(bool); alert(typeof(str) + ': ' + str); var num = Number(bool); alert(typeof(num) + ': ' + num); var obj = Object(bool); alert(typeof(obj) + ': ' + obj); var obj = {}; var str = String(obj); alert(typeof(str) + ': ' + str); var num = Number(obj); alert(typeof(num) + ': ' + num); var bool = Boolean(obj); alert(typeof(bool) + ': ' + bool); </script>