How does Javascript handle function parameters -


i had issue javascript goes against every bone of programming background. javascript me, i'm not surprised.

i have function such...

function x(param1, booleanparam, arrayparam){     .... } 

i getting runtime error saying arrayparam.length not defined. on debugging saw true , went find out why. turns out had forgotten comma in function call such...

x(param1, true [arrayjunk]); 

the problem i'm having figuring out why call made @ all? why isn't compile error, how javascript see , think, "yeah, seems might work!"

thanks in advance enlightenment can share!

that's indexing expression.
it's same syntax somearray[someindex].

it end passing undefined second parameter too, unless arrayjunk happens name of property of boolean primitives.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -