You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consts1='name.Lee's1.name='lee's1.age=function(){return100}console.log(s1.substring(5))// =>Leeconsole.log(typeofs1)// stringconsole.log(s1.name)// undefinedconsole.lgo(s1.age())// Uncaught TypeError: s1.age is not a function
letfoo=functionbar(){return123}console.log(typeofbar)// undefinedconsole.log(typeoffoo)// console.log(typeof bar()) // Uncaught ReferenceError: bar is not definedconsole.log(typeoffoo())// number
JavaScript数据类型
JavaScript基本数据类型/原始数据类型/值类型(六种)
Null
Undefined
String
Number
Boolean
Symbol
BigInt MDN
引用数据类型/对象数据类型(一种)
Object
Array
Function
Date
RegExp
包装类型(三种)
Number
String
Boolean
基本类型的字面量写法,很明显不能为基本类型添加属性和方法
new运算符写法,既能添加方法属性,还能使用它的内置方法
substring
null
和undefined
的区别undefined与null的区别---阮一峰
笔记:
判断JavaScript数据类型的方式(四种)
typeof
instanceof
toString
jquery
typeof
适用场景:
不适用场景:
面试题:
instanceof
toString
、Object.prototype.toString.call()
各个类型判断
特殊的
The text was updated successfully, but these errors were encountered: