I’m having trouble finding why this doesn’t work:
value = ( (value == undefined) || (typeof(value) !=== "number") ) ? 1 : value;
From what I understand this should set value to either 1 or value(variable), depending on whether or not value is not a number.
If value is not a number, change it to 1, if it is, keep it.
What am I doing wrong here?
From a quick look:
!=== (with three equal signs) is a typo. The correct operator is !== (with two equal signs).
Whenever you have Javascript problems, I strongly urge working through all warnings and problems at http://www.jslint.com/ –it helps catch a lot of stuff the eye doesn’t see easily.