Revision: 22917
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 25, 2010 17:45 by inkdeep
Initial Code
// Detecting the existence of a parameter /* Example 1: The in operator Detect whether there is a "myparameter" member in the "oArg" object: */ var myparameter = 'myparameter' in oArg? oArg.myparameter : ""; /* Example 2: The typeof operator Detect whether type of oArg.myparameter is not "undefined': */ var myparameter = typeof oArg.myparameter != 'undefined'? oArg.myparameter : ""; /* Example 2.1: The typeof operator version 2 Assuming parameter is a string, detect whether type of oArg.myparameter is "string": */ var myparameter = typeof oArg.myparameter == 'string'? oArg.myparameter : ""; /* Example 3: Autocasting Assign the value of oArg.myparameter to variable "myparameter" if it casts to true: */ var myparameter = oArg.myparameter || "";
Initial URL
Initial Description
Initial Title
Javascript - Detecting Parameters
Initial Tags
javascript
Initial Language
JavaScript