javascript判断数据类型
<DOCTYPE html> <html> <head> <title>判断数据类型</title> </head> <body> <script> var obj={ name:'张三', age:18, kill:['javascript','HTML5','CSS3','VUE'], web:{ HTML:'超文本标记语言', JS:{ name:'javascript' } }, say:function(){ } } for(var i in obj){ var str=Object.prototype.toString.call(obj[i]); var type=str.substring(8,str.length-1) console.log(i+'是'+type+'类型') } </script> </body> </html>