devXero's blog

a blog about agile, development, and automation

Posts Tagged ‘Javascript’

Triple equals in Javascript

Posted by Mike Longin on August 25, 2009

I know most of my posts are about agile, scrum, and automation, but I do come across some coding tips now and then and I wanted to pass them on.  In one of the sessions today, James Suchy demonstatrated doing TDD in javascript.  While going through this he demonstrated the triple equals comparison which I had seen once before but never looked at.

The tiple equals does a true comparison.  In Javascript == can be used to compare 0 and false.  Such that (0 == false) would return true.  However (0 === false) would return false.

I found this link that helped explain it a little better.

http://longgoldenears.blogspot.com/2007/09/triple-equals-in-javascript.html

Advertisements

Posted in Uncategorized | Tagged: | 2 Comments »