Home >  Archive >  2012 >  February >  9

Previous / Next

JavaScript is nice, but weird
By Dave Winer on Thursday, February 09, 2012 at 10:40 AM.
I've been slowly learning JavaScript over the last few months, and just got bit by something that I think is a mistaken design. I bet it's bit everyone for whom it's not their first Algol-like language. permalink
The problem came up with an image that had an "undefined" src property.  permalink
I could see it was undefined in Firebug. When the page loads it's not not undefined. I click on it, and boom it loses its definition. How could that be.  permalink
Well, you could have assigned it an undefined value. Let's look for an assignment. Found it. permalink
Search on Google. Aha. The weirdness. You can call a function with fewer parameters than it defines. The unspecified parameters are (ta dahh) undefined.  permalink
Even C, the most laissez-faire language in AlgolLand doesn't allow this! permalink
Once I knew what I was looking for I found it right off, fixed it, and all is good. :-) permalink
Adventures in programming with Uncle Davey.  permalink
This site contributes to the scripting.com community river.


© Copyright 1997-2012 Dave Winer. Last update: Thursday, February 09, 2012 at 10:46 AM Eastern. Last build: 2/29/2012; 5:43:15 PM. "It's even worse than it appears."

RSS feed for Scripting News

Previous / Next