We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
以上都不理解?没事,看代码
function getName() { console.log(this.name) } getName(); // undefined getName.call({name: 'qp'}); // qp getName.apply({name: 'qp'}); // qp
看代码
function getName(...param) { console.log(param) } getName(); // undefined getName.call({}, 'qp', 'qp'); // ['qp', 'qp'] getName.apply({}, ['qp', 'qp']); // ['qp', 'qp']
The text was updated successfully, but these errors were encountered:
No branches or pull requests
网上搜索call和apply的使用方法,大多数时候总是把这两个方法搞混,所以我尝试用一些取巧的方式去记忆。
call和apply的共同点:
以上都不理解?没事,看代码
call和apply的不同点:
如果容易记混的话,就看apply和array长得特别像,就不会搞错了。
看代码
The text was updated successfully, but these errors were encountered: