JS 基础知识点及常考面试题(一)

原始类型

分为6个基本类型
number,string,Boolean,null,undefine,symble

对象类型

数组,对象,函数

typeOf和instanceOf

typeOf

基本类型
typeOf出了null,判断为object,其他均能正确判断
引用类型
函数判断为function,其他均为Object

instanceOf

内部机制主要是通过原型链来判断的
`const Person = function() {}
const p1 = new Person()
p1 instanceof Person // true

var str = 'hello world'
str instanceof String // false

var str1 = new String('hello world')
str1 instanceof String // true
`

类型转换

转Boolean

对象转原始类型

四则运算符

比较运算符

this

posted @ 2021-01-07 17:16  李亚静  阅读(94)  评论(0)    收藏  举报