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

箭头函数和普通函数 #147

Open
neptoo opened this issue Aug 21, 2024 · 0 comments
Open

箭头函数和普通函数 #147

neptoo opened this issue Aug 21, 2024 · 0 comments

Comments

@neptoo
Copy link
Owner

neptoo commented Aug 21, 2024

  • arguments 普通函数可以获取到函数传递进来的参数
  • this指向不同 普通函数是指向调用它的那个对象 箭头函数是指向创建时
  • return 如果没有大括号 箭头函数会自动返回 不需要写return关键字
  • 你需要将箭头函数赋值给一个变量 然后才能去调用 普通函数有方法名

普通函数的this 取决于它在哪里被调用

箭头函数的this不会被重新定义 它和 函数创建时的this一模一样

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

No branches or pull requests

1 participant