Within a function, I want to grab a set of parameters from a named array. What is the most efficient way of testing if the parameter exists in the array, and if it does, use it as a variable? I came up with a few alternatives.
target = $('#page_links')
if ( functionobject.target ) {
target = functionobject.target
}
//method 2:
var target = ''
if ( functionobject.target ) {
target = functionobject.target
}
else {
target = final_array
}
//method 3:
target = functionobject.target
if (typeof target == 'undefined') {
target = $('#page_links')
}