Skip to main content
added 10 characters in body
Source Link
Billy Moon
  • 58.9k
  • 27
  • 148
  • 244

You can use the arguments object which holds all arguments passed to a function - regardless of if they are defined or not...

test(name){
    var age = arguments[1] == undefined ? arguments[1]0 : NULLarguments[1]
    // do stuff here
}

You can use the arguments object which holds all arguments passed to a function - regardless of if they are defined or not...

test(name){
    var age = arguments[1] ? arguments[1] : NULL
    // do stuff here
}

You can use the arguments object which holds all arguments passed to a function - regardless of if they are defined or not...

test(name){
    var age = arguments[1] == undefined ? 0 : arguments[1]
    // do stuff here
}
Source Link
Billy Moon
  • 58.9k
  • 27
  • 148
  • 244

You can use the arguments object which holds all arguments passed to a function - regardless of if they are defined or not...

test(name){
    var age = arguments[1] ? arguments[1] : NULL
    // do stuff here
}