<html> <head> <script type="text/javascript" src="common.js"> document.write("inner"); </script> <script type="text/javascript"> var x=1; var str01='abc'; var str02="def"; //alert(typeof x); alert(typeof str01); //console.log(typeof x); </script> </head> <body> </body> </html>
首先在js中""和‘’是没有区别的,typeof能返回该对象的类型