Sunday, 20 August 2017

Is javascript method overloading allowed?

I have a function:



function bla(param1) {
// do stuff
}



If I change this to:



function bla(param1, param2) {
// do stuff
}


Will this affect how the function works? I.e. Can I run this function like this:




function("one");


AND like this:



function ("one", "two");


Will both work in all cases? And if so, will the second parameter just be null?

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...