background preloader

JavaScript

Facebook Twitter

Regex Tester.

Free JavaScript Books

Coding standards & Best practices. Coding standards & Best Practices. Design Patterns in Javascript. Code Conventions. This is a set of coding conventions and rules for use in JavaScript programming.

Code Conventions

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) { Best Practices. The Exceptional Performance team has identified a number of best practices for making web pages fast.

Best Practices

The list includes 35 best practices divided into 7 categories. Minimize HTTP Requests tag: content 80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. One way to reduce the number of components in the page is to simplify the page's design. Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet.

CSS Sprites are the preferred method for reducing the number of image requests. Image maps combine multiple images into a single image. Inline images use the data: URL scheme to embed the image data in the actual page. Reducing the number of HTTP requests in your page is the place to start. Top | discuss this rule Use a Content Delivery Network tag: server tag: css.

IDEs & Editors with JavaScript support

Debugging JavaScript in Browser. IE Developer Tools. Introduction Great tools play a critical role in developer productivity, and while many web development tools exist, they likely don't meet your needs in all tasks.

IE Developer Tools

For example, you may want to quickly debug JScript, investigate a behavior specific to Internet Explorer, or iterate rapidly to prototype a new design or try solutions to a problem. In order to improve developer productivity in these and similar scenarios, Internet Explorer 8 includes powerful, yet easy-to-use tools that have a few important characteristics: Integrated and simple to use: An instance of the Developer Tools comes with every installation of Internet Explorer 8. This enables debugging on any machine running Internet Explorer 8. Getting Started Getting started with the tools is simple: press F12 or click Developer Tools from the Tools menu. Once open, the tools exist in their own window, each one connected to a single tab in Internet Explorer.

Some features of the tools do not need the complete tools interface. Chrome DevTools. Firebug. Firebug includes a powerful JavaScript debugger that lets you pause execution at any time and see what each variable looked like at that moment.

Firebug

If your code is a little sluggish, use the JavaScript profiler to measure performance and find bottlenecks fast. Find scripts easily Many web applications are comprised of quite a number of files, and finding the one you want to debug can be a chore. Firebug's script file chooser sorts and organizes files into very clean list that will help you find any file in a snap. You can also type to filter the list. Pause execution on any line Firebug allows you to set breakpoints, which tell the debugger to pause execution when it reaches a specific line. To set breakpoints, just click on any line number, and a red dot will appear to indicate that the breakpoint is set. Pause execution, but only if... Breakpoints can be troublesome if you find them breaking too often. To set a conditional breakpoint, just right-click on any line number.

Frameworks & Libraries