For those who’ve never seen an ‘if’ statement in railroad diagram form
The if statement changes the flow of the program based on the value of the expression. The then block is executed if the expression is truthy; otherwise, the optional else branch is taken.
Here are the falsy values:
- The empty string ”
- The number 0
- The number NaN
All other values are truthy, including true, the string ‘false’, and all objects.
Speaking of Bookmarklets, I came across this very cool one the other day: SelectorGadget. SelectorGadget is an open source bookmarklet that provide CSS selector information about DOM objects on a web page.
It can be found here:
The selector info it provides can be used in jQuery. This makes getting the right syntax for querying the DOM a snap.
Check out the author’s screencast on the front page.
A common way to use the bookmarklet is to provide it in the form of an href element which you then drag to the bookmarks menu in the web browser.