javascript - function passed as parameter call error
phpcn_u1582
phpcn_u1582 2017-05-18 11:02:38
0
2
387

code show as below

var f = function(call,args){
    call(args);
}

When executing f(console.log,123), there is no problem.
But when executing f(loaction.reload,true), an error is reported.
Error message As followsUncaught TypeError: Illegal invocation

phpcn_u1582
phpcn_u1582

reply all(2)
PHPzhong
f(loaction.reload.bind(location),true)

Explain that the reload method cannot be executed without the location object.

伊谢尔伦

for instance:

location.reload.call(location, true)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template