T
transkawa
these are my newbie lessons in javascripts.just wanted to share them.
1. never take literals for granted, especially when you're going to use
them for evaluating logical expressions. typeof myobj where myobj is
declared var myob = 'true'; could return string when you are thinking of
booleans. note for newbies like myself.
whenever you tend to use literals, have eval function handy.
2. whenever you parseInt or parseFloat, return Number.NaN where you
expect an error. you can spend a whole day wondering what the problem is
without NaN.
lessons learnt from sweating it out.
xnt
1. never take literals for granted, especially when you're going to use
them for evaluating logical expressions. typeof myobj where myobj is
declared var myob = 'true'; could return string when you are thinking of
booleans. note for newbies like myself.
whenever you tend to use literals, have eval function handy.
2. whenever you parseInt or parseFloat, return Number.NaN where you
expect an error. you can spend a whole day wondering what the problem is
without NaN.
lessons learnt from sweating it out.
xnt