javascript - using an each-ready function for only one element? -


using jquery, can like

[1,2,3].each(my_func) 

and inside my_func, don't receive arguments, can reference current number variable this.

now let's want call my_func again 1 element. way:

[1].each(my_func) 

is there better way call function again 1 element?

yes; there easier way:

myfunc(1); 

if want pass this, it's still easy:

myfunc.call(1); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -