If you are familiar with PHP’s
The isset() equivalent in JavaScript is the following code:
if (typeof variable_name !== 'undefined') {
// variable_name has been set, so run this code
}
If you want to check if a JavaScript object’s property exists, run the following code:
if (object_name.hasOwnProperty('action')) {
// the object_name object has the action property, so run this code
}