Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

作用域·测试题 #107

Open
smileyby opened this issue Jun 17, 2021 · 2 comments
Open

作用域·测试题 #107

smileyby opened this issue Jun 17, 2021 · 2 comments
Labels

Comments

@smileyby
Copy link
Owner

作用域测试题

  1. 变量提升 函数foo(声明+定义)
  2. function foo(){} 这一行执行时,浏览器会把 这一行之前对foo的操作,不仅认为是私有的,也会给全局映射一份;在之后的操作都认为是私有的(此操作是为了:兼容ES3和ES6)
  3. foo = 1,块级作用于中的foo赋值为1
  4. 输出全局下的 foo ,结果为 function foo(){}
@smileyby
Copy link
Owner Author

作用域测试题·2
作用域测试题·3

@smileyby
Copy link
Owner Author

以上代码的输出结果取决于,浏览器是否可以识别 块级作用域

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant