Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript set variable if not defined

var x = (typeof x === 'undefined') ? your_default_value : x;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #set #variable #defined
ADD COMMENT
Topic
Name
2+6 =