How do you know which parameters to set for a javascript function? -


coming java, javascript can frustrating.

i'm hoping can put simple terms me.

i'm struggling understand how javascript programmers know parameters pass method they're calling - when method being called callback (which in eyes seems added level of complexity).

for example, take function addeventlistener. in function, typical use looks like

mydomitem.addeventlistener("click", function(e){...}, false); 

in documentation function (hyperlinked name above) don't see mention of option. whereas in java can know if parameters match type ide, in javascript seems huge guessing game or requires serious in-depth knowledge of each function.

how javascript programmers it?

the documentation linked show form in example:

target.addeventlistener(type, listener[, usecapture]); 

the type parameter string "click", listener function object, , usecapture false.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -