two things i've learned from javascript.

Discussion in 'Javascript' started by transkawa, Jun 8, 2010.

  1. transkawa

    transkawa Guest

    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
    --
    happy are those who have endured
    for they shall reap bountifully
    --the gospel according to an avatar
    transkawa, Jun 8, 2010
    #1
    1. Advertising

  2. transkawa

    David Mark Guest

    On Jun 8, 1:51 pm, transkawa <> wrote:
    > 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.
    David Mark, Jun 8, 2010
    #2
    1. Advertising

  3. David Mark wrote:

    > On Jun 8, 1:51 pm, transkawa <> wrote:
    >> [...]


    Is it too much to ask for to look a bit harder and to not feed the trolls?

    --
    PointedEars
    Thomas 'PointedEars' Lahn, Jun 8, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bebop o'saurus
    Replies:
    15
    Views:
    1,791
    Raymond Lee
    Nov 13, 2004
  2. S Austin
    Replies:
    1
    Views:
    333
    Victor Bazarov
    Jan 29, 2004
  3. James Lee

    Learned something new today - thoughts?

    James Lee, Sep 25, 2003, in forum: C Programming
    Replies:
    9
    Views:
    346
    Martijn
    Sep 27, 2003
  4. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    vs2005 publish website doing bad things, bad things

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    585
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 25, 2006
  5. Alex DeCaria
    Replies:
    4
    Views:
    106
    Alex DeCaria
    Feb 21, 2010
Loading...

Share This Page