View Single Post
Unread 09-01-2007, 07:22 PM
bcarl314 bcarl314 is offline
Senior Member
Join Date: Aug 2007
Posts: 141
  #1  
Default assigning default values to undefined variables

I'm moving from php to JavaScript. What I want to do is assign a value to a variable only if the variable hasn't been assigned yet. In php it would be: if($variable=='') $variable='default value'; I thought the equivalent in javascript would be: if(variable=='')
Reply With Quote