Javascript define a variable if it isn’t defined currently

By Forrest Smith - Drempd.com

It seems like this comes up quite a bit.  This will create a new variable if the variable isn\’t currently defined:

var myVariable = myVariable || “”;

Or to define it as an array:

var myVariable = myVariable || {};