A couple of weeks ago, I asked for help on several mailing lists about learning Javascript. Several people asked me to share what I'd learned, so I'm posting this summary to the same lists.
It looks to me like the first two (Netscape and O'Reilly) are what I was looking for, but since different people learn differently, I'm including everything. If you haven't seen script.aculo.us, check it out. I anonymized all recommendations and quotations to respect people's privacy. -- Netscape's Javascript docs http://www.mozilla.org/docs/web-developer/ Especially: Core Javascript Guide Core Javascript Reference Use both 1.5 and 1.4 versions because 1.5 doesn't discuss DOM, 1.4 does. -- Javascript: The Definitive Guide David Flanagan O'Reilly Press (the Rhino Book) recommended by several people -- Firefox/Mozilla Javascript Console Venkman Javascript Debugger http://www.svendtofte.com/code/learning_venkman/ -- http://webmonkey.wired.com/webmonkey/ -- http://del.icio.us/tag/javascript -- Mastering Javascript and JScript James Jaworski -- Javascript Visual Quickstart (book) -- http://script.aculo.us/ -- http://www.sitepoint.com/books/dhtml1/ http://www.sitepoint.com/blog-post-view.php?id=171578 -- Private communication: "The most important thing to understand about Javascript is that it's designed for dummies. That's why it doesn't care about your function declaration, and why you can just start using a variable without declaring it. Javascript almost seems to guess what it is you want to do, and it's not very good at guessing. "And most of the people writing code are dummies, or at least disinterested. Apparently just about nobody knows you can populate an array when you declare it, and a lot of people seem unclear on the concept of arrays having a length property. "Not very helpful I know, but hopefully I've give you an idea of what you're up against. My best advice is to find examples on the web and then try to figure out how to improve on them. The good news is that compaired to a "real" language, there's just not much to learn." -- Private communication: "There is exactly one data type: object. An object has a string name, and zero or more properties. A property's name is an object, and a property's value is an object. "Structs are objects, arrays are objects, functions are objects, classes are objects, execution contexts are objects, etc. Everything is an object. There's syntactic sugar to make things look like regular old Algol-style structs/arrays/functions/strings/numbers, but underneath: objects. "Arrays are objects where the property names are numbers. Of course you can also use strings as array indexes, giving you associative arrays. JavaScript doesn't care, the index is just a property name. a['foo'] is exactly equivalent to a.foo. "The web references on JavaScript look superficial, but really that's just because the language is pretty small. Basic JavaScript: http://www.w3schools.com/js/default.asp Accessing the DOM: http://www.w3schools.com/js/js_obj_htmldom.asp Two things you'll want to google further about: prototype functions, and function closures." -- ECMAscript language spec. http://www.ecma-international.org/publications/standards/Ecma-262.htm -- www.amazon.com, Borders, Barnes & Noble -- http://www.maththinking.com/boat/booksIndex.html -- www.javascript.com -- Private communication: >How do you debug this stuff? Yeah, that's a problem. There has to be some call that puts up a message in the JavaScript Console, but I haven't found it yet. And anyway, that only exists in Firefox so it doesn't help you debug problems with other browsers. One thing I've done is make my own console thingy. Somewhere on the page you have a div like this: <div id="log" style="height: 20em; overflow: auto" /> Then make a function like so: var logDiv = document.getElementById( 'log' ); function log( s ) { logDiv.innerHTML += s + '<br />'; } Then you can do printf debugging. There's also the alert() built-in that pops up a message box, that's good for single messages. I've also heard of a JavaScript debugger plugin for Firefox called Venkman, but it wouldn't run for me and again it wouldn't help with other browsers. -- http://www.borngeek.com/firefox/tutorial/part_07.html http://kb.mozillazine.org/JavaScript_Console -- Bob Miller K<bob> kbobsoft software consulting http://kbobsoft.com [EMAIL PROTECTED] _______________________________________________ EUGLUG mailing list [email protected] http://www.euglug.org/mailman/listinfo/euglug
