background preloader

JavaScript documentation sites

Facebook Twitter

Inheritance and the prototype chain. JavaScript is a bit confusing for developers experienced in class-based languages (like Java or C++), as it is dynamic and does not provide a class implementation per se (the class keyword is introduced in ES6, but is syntactical sugar, JavaScript remaining prototype-based). When it comes to inheritance, JavaScript only has one construct: objects. Each object has an internal link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. null, by definition, has no prototype, and acts as the final link in this prototype chain. While this is often considered to be one of JavaScript's weaknesses, the prototypal inheritance model is in fact more powerful than the classic model.

Inheritance with the prototype chain Inheriting properties JavaScript objects are dynamic "bags" of properties (referred to as own properties). Following the ECMAScript standard, the notation someObject. Inheriting "methods" Essential JavaScript Links. The Two Pillars of JavaScript — JavaScript Scene. Before we get into this, allow me to introduce myself — you’re probably going to wonder who I think I am before this is over. I’m Eric Elliott, author of “Programming JavaScript Applications” (O’Reilly), host of the feature-length documentary film-in-production, “Programming Literacy”, and creator of the “Learn JavaScript with Eric Elliott” series of online JavaScript courses. I have contributed to software experiences for Adobe Systems, Zumba Fitness, The Wall Street Journal, ESPN, BBC, and top recording artists including Usher, Frank Ocean, Metallica, and many more. Once Upon a Time I was trapped in the darkness. I was blind — shuffling about, bumping into things, breaking things, and generally making an unholy mess of everything I touched.

In the 90's, I was programming in C++, Delphi, and Java and writing 3D plugins for the software suite that eventually became Maya (used by lots of major motion picture studios to make summer blockbuster movies). Then it happened: The internet took off. A Simple TODO list using HTML5 WebDatabases. On November 18, 2010, the W3C announced that Web SQL database is a deprecated specification. This is a recommendation for web developers to no longer use the technology as effectively the spec will receive no new updates and browser vendors aren't encouraged to support this technology. Many major browsers including Chrome, Safari, Opera and nearly all Webkit based mobile devices support WebSQL and will likely maintain support for the foreseeable future. Introduction Web Databases are new in HTML5. Web Databases are hosted and persisted inside a user's browser. By allowing developers to create applications with rich query abilities it is envisioned that a new breed of web applications will emerge that have the ability to work online and off-line.

This tutorial is also available written using "IndexedDB", the replacement offline storage technology. The example code in this article demonstrates how to create a very simple todo list manager. Pre-requisites Asynchronous and Transactional. Perfection Kills. What you should know about JavaScript regular expressions. Regular expressions in JavaScript may not always be intuitive. I aim to provide some clarity by providing examples about things I have found myself getting stuck on. This post covers a few topics including state in regular expressions, regular expression performance and various things that have tripped me up. regular expressions are stateful Regular expression objects maintain state.

For example, the exec method is not idempotent, successive calls may return different results. Calls to exec have this behavior because the regular expression object remembers the last position it searched from when the global flag is set to true. As an example, examine the following code: jsfiddle The log prints: regexp.lastIndex: 0 regexp.lastIndex: 9 index: 0 res[0]: foo1 bar1 res[1]: bar1 regexp.lastIndex: 18 index: 10 res[0]: foo2 bar res[1]: bar regexp.lastIndex: 30 index: 21 res[0]: foo3 bar2 res[1]: bar2 regexp.lastIndex: 0 The variable text contains a string that we want to search. Jsfiddle jsfiddle /foo. JavaScript — The weird parts. Writing code for humans. | Human JavaScript. Are you bad, good, better or best with Async JS? JS Tutorial: Callbacks, Promises, Generators. Tutorials Round-Up: Ajax, CSS, PHP and More. Advertisement Coding or designing a page, it’s always nice to have some basic templates you can quickly modify or adapt to your needs.

However, at least once you have to know, how to create this “universal” template. In this case tutorials prove to be an ultimate solution, particularly if you just want to get an idea how something works and where to start from. In fact, you don’t have to re-invent the wheel all the time – you can use existing solutions, modify and improve them and publish them as well – just the way other people did it for you. In this post we’ve covered over 200 Ajax, CSS, Flash, JavaScript, PHP, MySQL, RSS, XML as well as ASP, C++, Perl, Python and Java tutorials. Links checked: June/09 2008. You may want to take a look at our related posts Ajax CSS Techniques Lightboxes & GreyBoxes. Impressivewebs/frontend-feeds. Learn JavaScript: — JavaScript Scene. There are so many JavaScript resources available out there, it’s hard to understand how much of it overlaps and how much is redundant.

Not to mention the process of weeding out bad information. Most JavaScript learning resources neglect two of the most important topics in JavaScript: prototypal inheritance and functional programming. There are many possible paths, several good paths, but few great paths. Here is one clear path to JavaScript mastery: JavaScript is the standard language of the web platform. The essentials, in order: Newbie friendly: Make a Star Wars Game with Hour of Code (free website)Newbie friendly: “JavaScript for Cats”, Max Ogden (free website)Newbie friendly: FreeCodeCamp’s Basic JavaScript track You can come back to FCC for more practice while you explore the rest of these resources. On ES6 ES6+ (ES2018 as of this writing) is the current JavaScript standard, but many of the existing learning resources are written for an older version of JavaScript.

On JavaScript Modules. RequireJS made ridiculously easy, in just 10ish minutes - Yazin - 0xTech. Understanding RequireJS for Effective JavaScript Module Loading. Modular programming is used to break large applications into smaller blocks of manageable code. Module based coding eases the effort for maintenance and increases reusability. However, managing dependencies between modules is a major concern developers face throughout the application development process.

RequireJS is one of the most popular frameworks around for managing dependencies between modules. This tutorial examines the need for modularized code, and shows how RequireJS can help. Loading JavaScript Files Large applications often require a number of JavaScript files. Purchase.js products.js credits.js In this example, we are trying to purchase a product. What Can Go Wrong? In this example, purchase.js depends upon both credits.js and products.js. Here, initialization is done before credits.js is loaded. Introduction to RequireJS RequireJS is a well known JavaScript module and file loader which is supported in the latest versions of popular browsers. Creating Applications with RequireJS. Read JavaScript Allongé. A Pull of the Lever: Prefaces “Café Allongé, also called Espresso Lungo, is a drink midway between an Espresso and Americano in strength. There are two different ways to make it. The first, and the one I prefer, is to add a small amount of hot water to a double or quadruple Espresso Ristretto.

Like adding a splash of water to whiskey, the small dilution releases more of the complex flavours in the mouth. “The second way is to pull an extra long double shot of Espresso. This achieves approximately the same ratio of oils to water as the dilution method, but also releases a different mix of flavours due to the longer extraction. Foreword by Michael Fogus As a life-long bibliophile and long-time follower of Reg’s online work, I was excited when he started writing books. The act of writing is an iterative process with (very often) tight revision loops.

In the case of JavaScript Allongé, you’ll find the Leanpub model a shining example of effectiveness. Enjoy. – Fogus, Instead of: Legend. Speaking JavaScript: An In-Depth Guide for Programmers. Airbnb/javascript. Resources for Staying on Top of JavaScript - Tuts+ Code Article. Last year, I wrote about and recommended some great resources for getting good with andJavaScript.

A year is a long time in Internet terms and I figured now was a good time for a refresh. JavaScript continues to explode in terms of adoption and being fully embraced, not only in the browser but also on the server. So it's about time we revisit the list and update it with good places to stay current. With JavaScript's continued adoption rate, there's been an explosion of books but from what I've seen, only a small percentage are offering new and interesting reading material. Here are the ones I've enjoyed so far: I'm keeping this one on the list because I honestly haven't seen a new book that so thoroughly covers the JavaScript language like Nicholas' does. There's no argument that leveraging good design patterns helps in building maintainable code.

One of the consistent issues developers face with JavaScript is the concept of object-oriented programming. Dr. Don't let the name fool you. jQuery Anti-Patterns and Best Practices - Tuts+ Code Tutorial. A long time ago, in a galaxy far, far away, JavaScript was a hated language. In fact, "hated" is an understatement; JavaScript was a despised language. As a result, developers generally treated it as such, only tipping their toes into the JavaScript waters when they needed to sprinkle a bit of flair into their applications. Despite the fact that there is a whole lot of good in the JavaScript language, due to widespread ignorance, few took the time to properly learn it. Instead, as some of you might remember, standard JavaScript usage involved a significant amount of copying and pasting.

"Don't bother learning what the code does, or whether it follows best practices; just paste it in! " - Worst Advice Ever Because the rise of jQuery reignited interest in the JavaScript language, much of the information on the web is a bit sketchy. Ironically, it turns out that much of what the development community hated had very little to do with the JavaScript language, itself. Ready for the truth? Done! William Malone { Articles } Javascript Interview Questions. Dos and Don’ts in JavaScript. A few best practices for when you’re learning the language With every programming language, there’s a list of do’s and don’ts and JavaScript is no exception. Some of these best practices are there for your protection (like always always always using semi-colons!) , some to make your code more readable and less error-prone, and some to increase the efficiency of your code. If you search for “best practices JavaScript” you’ll find lots of great information on the topic.

In this installment of Head First JavaScript Programming Teasers, we take a look at a few common best practices that will help make your code more readable, make the best use of the language, and make your code a bit more efficient. JavaScript’s Apply, Call, and Bind Methods are Essential for JavaScript Professionals. Prerequisite: — Understand JavaScript’s “this” With Ease, and Master It. — JavaScript Objects — Understand JavaScript Closures (This is an intermediate to advanced topic) Duration: About 40 minutes. Functions are objects in JavaScript, as you should know by now, if you have read any of the prerequisite articles. And as objects, functions have methods, including the powerful Apply, Call, and Bind methods. On the one hand, Apply and Call are nearly identical and are frequently used in JavaScript for borrowing methods and for setting the this value explicitly. We also use Apply for variable-arity functions; you will learn more about this in a bit.

On the other hand, we use Bind for setting the this value in methods and for currying functions. We will discuss every scenario in which we use these three methods in JavaScript. JavaScript’s Bind Method We use the Bind () method primarily to call a function with the this value set explicitly. Let’s continue with the same example we used above. View Source...learn to create the web. Native HTML5 Drag and Drop. Introduction For years, we've been using libraries like JQuery and Dojo to simplify complex UI elements like animations, rounded corners, and drag and drop. There's no doubt, eye-candy is important for making rich, immersive experiences on the web. But why should a library be required for common tasks that all developers are using? Drag and drop (DnD) is a first class citizen in HTML5!

Feature Detection Many apps that utilize DnD would have a poor experience without it. If you need to rely on an API, always use feature detection rather than sniffing the browser's User-Agent. If (Modernizr.draganddrop) { // Browser supports HTML5 DnD. } else { // Fallback to a library solution. } Creating draggable content Making an object draggable is simple. As an example, let's start creating rearrangeable columns. It's worth noting that in most browsers, text selections, img elements, and anchor elements with an href attribute are draggable by default. Result (draggable but won't do anything): 1. Result: HTML Audio/Video DOM Reference. JavaScript Kit Advanced JavaScript Tutorials. Javascript | search. Highest Voted 'javascript' Questions - Page 2. JavaScript Developer Center. Yahoo! Language centers have been deprecated.

If you have any concerns or questions, please don't hesitate to contact us in General Discussion at YDN forum. Do you eat, sleep and breathe JavaScript? This is your source for information for using JavaScript with Yahoo! Yahoo! Yahoo! These Yahoo! Yahoo! Yahoo! Yahoo! Yahoo! Documentation & Articles We've written a whole bunch of stuff to help you get up to speed with our APIs if you use JavaScript. AJAX & XMLHttpRequest HOWTO: Use a Web Proxy for Cross-Domain XMLHttpRequest Calls: Why do you need a web proxy to use XMLHttpRequest?

HOWTO: Make Yahoo! How To Build a Maps Mashup: Use the Yahoo! Fixing AJAX: XMLHttpRequest Considered Harmful: Various ways of working around around browser security issues with XMLHttpRequest calls made between domains. JSON (JavaScript Object Notation) Using JSON (JavaScript Object Notation) with Yahoo! Web Services + JSON = Dump Your Proxy: Use the Yahoo!

Yahoo! AJAX API Getting Started: Yahoo! Yahoo! Yahoo! JavaScript. JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript. This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. The standard for JavaScript is ECMAScript. Tutorials Learn how to program in JavaScript with guides and tutorials.

For complete beginners Head over to our Learning Area JavaScript topic if you want to learn JavaScript but have no previous experience of JavaScript or programming. JavaScript first steps Answers some fundamental questions such as "what is JavaScript? " JavaScript building blocks.