I have a piece of javascript code like this
if(prog > 100)
prog = 100;
else if(prog <0)
prog = 0;
else if(typeof prog != 'number')
prog = 0;
It looks bad and ugly. Is there some cooler way to write this in javascript?
How about this:
Which would simply require this to be defined: