Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > two things i've learned from javascript.

Reply
Thread Tools

two things i've learned from javascript.

 
 
transkawa
Guest
Posts: n/a
 
      06-08-2010


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
 
Reply With Quote
 
 
 
 
David Mark
Guest
Posts: n/a
 
      06-08-2010
On Jun 8, 1:51*pm, transkawa <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      06-08-2010
David Mark wrote:

> On Jun 8, 1:51 pm, transkawa <(E-Mail Removed)> wrote:
>> [...]


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

--
PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running two versions of Ruby - Lessons Learned Alex DeCaria Ruby 4 02-21-2010 01:40 PM
30 things I've learned ... Peter NZ Computing 18 08-17-2007 10:25 AM
vs2005 publish website doing bad things, bad things =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?= ASP .Net 1 10-25-2006 06:18 PM
MCSD Insights or What I learned on the way to MCSD.NET Cert land.... charlie MCSD 9 02-26-2004 09:17 PM
D100 in Scotland - 10 random things I learned (some OT, some rant) mikey2 Digital Photography 6 09-09-2003 05:10 PM



Advertisments