Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

javascript 的全局函数

以下哪些是 javascript 的全局函数(多选题)
A. parseFloat
B. eval
C. setTimeout
D. alert

答案是AB

为什么setTimeout和alert不是呢?javascript全局函数的定义到底是什么呢?

求求求求求各位走过路过的大佬解答万分感谢


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

严格来说,setTimeoutalert 都是 window 对象下的方法,是全局对象下的方法、而非全局方法。

全局方法应该指的是 ECMAScript 中定义 global 方法,完整清单:


P.S. 这种题就是脑筋急转弯,对编程一点儿帮助都没有。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...