2019/9/5
第五部分:⾼频考点 | FE-Interview
blog.poetries.top/FE-Interview-Questions/excellent/#_36-5-动态规划
1/166
第
五
部
分
:
⾼
频
考
点
1
typ
e
o
f
类
型
判
断
typeof
是
否
能
正
确
判
断
类
型
?
instanceof
能
正
确
判
断
对
象
的
原
理
是
什么
typeof
对
于
原
始
类
型
来
说
,
除
了
null
都
可
以
显
示
正
确的
类
型
typeof
对
于
对
象
来
说
,
除
了
函
数
都
会
显
示
object
,
所
以
说
typeof
并
不
能
准
确
判
断
变
量
到
底
是
什么
类
型
如
果
我
们
想
判
断
⼀个
对
象
的
正
确
类
型
,
这
时
候
可
以
考
虑
使
⽤
instanceof
,
因
为
内
部
机
制
是
通过
原
型
链
来
判
断
的
typeof 1 // 'number'
typeof '1' // 'string'
typeof undefined // 'undefined'
typeof true // 'boolean'
typeof Symbol() // 'symbol'
typeof [] // 'object'
typeof {} // 'object'
typeof console.log // 'function'
const Person = function() {}
const p1 = new Person()
p1 instanceof Person // true
var str = 'hello world'
str instanceof String // false
j
s
j
s
j
s
评论0