two things i've learned from javascript.

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
 
D

David Mark

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.

The lesson is not to think of string literals as booleans. The next
lesson is to forget that eval exists.
2. whenever you parseInt or parseFloat, return Number.NaN where you
expect an error.

I can't make heads or tails of that.
you can spend a whole day wondering what the problem is
without NaN.

You can spend a lifetime wondering or a considerably shorter period
learning.
lessons learnt from sweating it out.

You seem to be on the wrong course.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top