background preloader

Learning

Facebook Twitter

Code Conventions for the JavaScript Programming Language. This is a set of coding conventions and rules for use in JavaScript programming. The long-term value of software to an organization is in direct proportion to the quality of the codebase. Over its lifetime, a program will be handled by many pairs of hands and eyes. If a program is able to clearly communicate its structure and characteristics, it is less likely that it will break when modified in the never-too-distant future. Code conventions can help in reducing the brittleness of programs.

All of our JavaScript code is sent directly to the public. JavaScript Files JavaScript programs should be stored in and delivered as .js files. JavaScript code should not be embedded in HTML files unless the code is specific to a single session. Whitespace Where possible, these rules are consistent with centuries of good practice with literary style. Blank lines improve readability by setting off sections of code that are logically related. while (true) { Avoid excessively long lines. Use line comments. Is. Learn JavaScript. 6 html and javascript codes to crash IE6. Let’s start with the longest of all: Javascript and IE6, a true love story… <script>for (x in document.write) { document.write(x);}</script> This one was discover last year: Anti-IE Javascript strikes back!

Now my favorite: 11 symbols and…bang This one is the only one I know which make IE7 crash: function getX( oElement ) { var iReturnValue = 0; while( oElement ! Have some nice crashs. On the Performance of JavaScript Getters – codepanda. While working on Directional Navigation , I abstracted out some geometric calculations into their own object. I implemented them as getters , because only some of the values were used in any given situation and so I wanted them to be calculated on demand. Well, that and I just like getter syntax; I blame a lot of my syntactic spoiling on Ruby. Unfortunately, this was critical enough code that the poor performance of getters in firefox was noticeable to the human eye and failed to offset the cost of the geometric calculations they wrapped.

Herein I will demonstrate the performance disparity between properties, functions, and getters in Javascript across 3 browsers: Firefox, Safari, and Opera. The Setup I ran the tests on my MacBook (2.26 GHz Core 2 Duo with 4GB 1066 MHz RAM) with the following browser versions: Firefox 3.6.10 Safari 5.0 (6533.16) Opera 10.62 By no means am I claiming this experiment to be truly scientific or statistically sound. The Code And here are the stub objects I used: The Best Way to Learn JavaScript. Learning something new is scary.

For me, the biggest issue with picking up a new skill is that I don’t know what I don’t know. Given that, it’s often useful to find a plan for learning whatever you’re interested in. That’s what this post is: your blueprint, your roadmap, your plan of action for learning JavaScript! You don’t have to worry about finding the best resources, sorting out the bad ones, and figuring out what to learn next. It’s all here. Just follow it, step by step. JavaScript is the language of the browser. Before you actually begin learning JavaScript, take a minute to understand what it is and does.

JavaScript is not jQuery, Flash, or Java. JavaScript is the language of the browser (not exclusively these days, though). One more note: you’ve heard about jQuery, which is probably the most widely-used JavaScript library. You might even have heard someone say that you should start with jQuery (or another library) and learn JavaScript after. So, what can you build?