JavaScript is a lightweight, interpreted programming language that is used for client-side web development. It was originally introduced in 1995 to make web pages more interactive and has since expanded to server-side applications through Node.js. Some best practices for JavaScript include using meaningful variable names, writing narrative code, avoiding polluting the global namespace, using strict mode, isolating DOM access, following common patterns like the module pattern, and progressively enhancing functionality while degrading gracefully without JavaScript.
1 of 32
Downloaded 10 times
More Related Content
JavaScript: the who, what, when, where, why, & how
4. what
JavaScript is a lightweight, interpreted, object-
oriented language with first-class functions.
5. the server side
? 1994 Netscape Enterprise Server
? 1996 Microsoft IIS 3.0
? Today: Node.js
6. the client side
Adobe Flash, Google Chrome, Nexus 7, Firefox, Opera,
Safari, iPad, Kindle PaperWhite, Windows 8, Internet
Explorer 9, Windows Phone
7. The Language & Its Libraries
? Like Java and .NET, JavaScript has its go-to libraries
? Libraries! extend the present, polyfill the past, and
pioneer the future
17. why
? Pervasive: It¡¯s everywhere
? Performance: Browser Wars for the win
? Mutable: JS lets you do stuff
? Community: Welcome to brogrammer culture
? Mashups
? Cross Platform: Apps for Windows 8, to iPhone, to
Android
? Circumvent Your CMS
? Responsive Web Design
23. best practices
Unobtrusive JavaScript
? Code is decoupled from markup; only binding of
behavior to DOM is the CSS selector.
? Styles are decoupled from code (antipatterns:
Twitter Badge JS, Titanium 2)
30. best practices
? Compress (e.g. YUI Compressor)
? Concatenate to avoid network latency & HTTP
overhead
? Synchronous JavaScripts blocks the browser, so load
last on the page