javascript - cannot let another variable point to console.log -


this question has answer here:

i new javascript terminologies might wrong. since functions variables in javascript, why chrome console complain when

var f = console.log   

and apply

f(123)   

the error log following.

uncaught typeerror: illegal invocation       @ <anonymous>:2:1       @ object.injectedscript._evaluateon (<anonymous>:905:140)       @ object.injectedscript._evaluateandwrap (<anonymous>:838:34)       @ object.injectedscript.evaluate (<anonymous>:694:21)   

works here: http://jsfiddle.net/8pl5lgd2/

var f = console.log; f("!23"); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -