4 ms·
Learning Advanced JavaScript
- ximeng 16y agoPrevious discussion for reference: http://news.ycombinator.com/item?id=823347 http://news.ycombinator.com/item?id=823347
- rudenoise 16y agoI think this is probably a re-post, but worth repeating for those who may have missed it. Complete this, read JavaScript The Good Parts and JS becomes more pleasurable. If you're interested in improving, I highly recommend taking an hour to work through this tutorial in the console.
- deleted 16y ago[deleted]
- mrspeaker 16y agoIt's great, but certainly is pretty old - look at the source of the linked jQuery: "jQuery 1.2.6 - New Wave Javascript"! I don't think that tag line stuck ;)
- code_duck 16y agoIt is pretty old; I think I've seen it twice on here and three times on reddit. Good tutorial, though and of course still relevant. It would be great if John (or another JSer) would update or add to it.
- dhimes 16y agoHow does JS: TGP compare to JS: The Definitive Guide (Flanagan)? I have Flanagan but am curious as to whether TGP is worth buying also. I also recently found the Crockford videos here: http://developer.yahoo.com/yui/theater/ http://developer.yahoo.com/yui/theater/ I watched the first one yesterday. It was a nice intro to what I might call the philosophy of/behind JavaScript, and I'm hoping the others give me a few "aha!" moments about how to design my code.
- hammerdr 16y agoThink of TGP as a filtered version of TDG. It's a high impact, low word count book that covers 90% of what you'll ever need to know for Javascript. TDG, on the other hand, tells you _everything_.
- adolph 16y agoI haven't read/used TDG in a while; I have read/used TGP recently. TGP is definitely "Aha," compared to TDG's "Oh, OK." Both have their place; TGP is handier to understanding and working with some of JS' quirks.
- euroclydon 16y agoI read TGP, and then I started using Google's Closure compiler. What I found was that Crokford recommends a lot of his own special ways of writing JS, and that they really aren't that great. To me Crokford's book is living in a pre-Closure-Compiler world, one where JSLint was the best tool to help you write good JS code, but in a CC world, Crokford's functional inheritance and use of JSLint are bad in the former, and unnecessary in the latter. EDIT: Inheritance Patterns in JavaScript by Michael Bolin: http://www.bolinfest.com/javascript/inheritance.php http://www.bolinfest.com/javascript/inheritance.php
- evanrmurphy 16y agoCan you give some other examples of Crockford's advice that you'd disregard or how the Closure Compiler affects the way you write JavaScript?
- euroclydon 16y agoI don't have his book in in front of me, but I remember him introducing and using helper function on the Object prototype to aid in inheritance. I read his book because it holds such an authoritative place in JS literature. Last year, I began writing an application which has grown to over 6K lines of JS. At this level, pure JS become unwieldy, IMO. I went looking for a technology to help my code stay organized, optimized, and well documented. Closure Compiler was it. But since I had created my inheritance structure following Crokford's functional methodology, CC wouldn't work with it. Also, the only game in town for documenting JS, is jsDoc, in it's various incarnations. At 7K LOC, I wanted good docs for future developers. jsDoc doesn't work with functional inheritance either, strictly prototypical. The bottom line for me is: Read the book, for sure, but if you plan on writing a large JS application, and go looking for help from a technology like CC (or maybe even DoJo), beware, that Crokford's recommendations (and they do come authoritatively) might put you in a place where you have to do a lot of refactoring down the road.
- rauljara 16y agoReally smart tutoring tool. I've seen other tutorials with editable javascript examples, but I think the combination of well chosen examples, use of asserts, and nice design brings it to a whole new level.
- jcw 16y agoThe Little Schemer would be great in this format.
- andreyf 16y agoWhile we're on the topic of great JavaScript references for people learning the language, this one is worth considering: http://eloquentjavascript.net/ http://eloquentjavascript.net/ The author's open source projects are quite pedagogical, as well: https://github.com/marijnh/ https://github.com/marijnh/
- endtime 16y agoI didn't know about function.length; the function overloading trick in the last section is pretty clever.
- robinduckett 16y agoThis is really nice, but I guess I already knew this stuff.
- ez77 16y agoA bit off topic: what is your interactive JS sandbox? (Firebug, Chrome console, Rhino... ?)
- nfriedly 16y agoFirebug for something quick, Rhino for something that is repeated often enough to be scripted. Occasionally Chrome's built-in console, but I just don't like it it as much as firebug. I've played with node.js a bit, but when I toyed with it it wasn't anywhere near production ready. (This was over a year ago, I might come back to it again sometime soon.)
- sjs 16y agoMost of the time I use Chrome's console and node in a terminal. If I'm in Emacs I might fire up swank-js[1] which lets me interact with standalone JS interpreters like v8 and Rhino, but also contains a server that bridges the gap between the major browsers. Simply open up a web page in Firefox, Safari, Chrome, or Opera and then interact with that browser's JS engine from Emacs. [1] https://github.com/ivan4th/swank-js https://github.com/ivan4th/swank-js
- paulirish 16y agohttp://tutti.tobyho.com http://tutti.tobyho.com is definitely the finest. You get an interactive console, and you get results from all browsers you want to test, immediately.
- amadeus 16y agoAnother really great tool is http://jsfiddle.net http://jsfiddle.net It allows you to mock up quick examples/bugs/etc.
- joakin 16y agoI've learnt a lot from this, but still digesting some parts of it. Thanks a lot, I missed it the other time
- onteria 16y agoFor those really wanting to learn JavaScript, I also recommend reading the Ecma 262 standard it is based upon: http://www.ecma-international.org/publications/standards/Ecma-262.htm http://www.ecma-international.org/publications/standards/Ecm... It will help you understand how the core of the language works. I also keep the Mozilla Javascript Reference: https://developer.mozilla.org/en/Javascript/Reference https://developer.mozilla.org/en/Javascript/Reference handy for looking things up. For the browser compatibility side: http://www.quirksmode.org/ http://www.quirksmode.org/
- iamuzer 16y agoI learned today, by chance, that you can reference an element object directly by its name without having to do a document.getElementById.
- weixiyen 16y agoWhat do you mean by that? Can you provide an example?
- jamesbritt 16y agoAre names unique, as IDs are (supposed to be)?
- shirtless_coder 16y agoIt's sad that there are so many copy-pasters out there in the javascript world that this is called "advanced" and not introductory.
- chrisohara 16y agocare to enlighten us with what you deduce to be advanced JavaScript?
- MichaelGlass 16y agoI learned JavaScript but as soon as I understood the capabilities (but before I mastered usage) I decided to do all of my work in CoffeeScript. I find it much cleaner / easier to write and I don't really see a downside to using it instead.
- steilpass 16y agoI highly recommend "Test-Driven JavaScript Development" http://tddjs.com/ http://tddjs.com/ for learning JavaScript. Because it involves actual coding.