Forum Moderators: open

Message Too Old, No Replies

Make a third parameter optional without error message when undefined?

How do I handle an undefined parameter without an error message?

         

JAB Creations

12:57 pm on Mar 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd like to have an optional third parameter though I don't want the error console complaining when it does not exist, how do I handle an undefined parameter in such a situation? I have trued to return, return true, return false, and null though since none of those worked I presume the extent of my know-how has run out.

- John

My JavaScript looks like this...

function ajax2(name3up,name2up,name1up)
{
if (name1up == undefined) {null;}
}

Fotiman

2:56 pm on Mar 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




function ajax2(name3up, name2up, name1up) {
if (typeof name1up == "undefined") {
return;
}
}

JAB Creations

3:17 pm on Mar 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Fotiman! It worked great! :)

- John