View Article
29

Normally I wouldn't expect myself to find a reason to blog about Javascript. After all, for anyone who's gone through the browser wars having tried to do dhtml the hard way and be browser friendly, Javascript, CSS, HTML, & DOM differences would be enough to make one vow never to touch the stuff again, particularly when the easy-to-control server-side .NET programming became available.

But, if you are interested in AJAX, you'll probably get back to the Javascript thing again (like I am about to).

So, along that vein, I thought I would note a post by Bertrand Le Roy about a nice, tight-coded way to ensure a javascript function returns a Boolean (as opposed to a null, undefined, or object. He also shared a way to force an undefined to return a null. Here's the code snippets:

something ? true : false

!!something

return something || null;

Ah! That's refreshing! Brings me back to my old C++ days....

Posted in: AJAX

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above in the box below