background preloader


Facebook Twitter


JavaScript Conquered the Web. Now It’s Taking Over the Desktop. JavaScript was originally created in 1995 to give web pages a little more pep than the <blink> tag could provide. Today it has far more powerful uses. Companies like Google and Facebook build complex, desktop-like web applications with JavaScript; since the launch of Node.js in 2009, it’s also become one of the most popular languages for building server-side software. Today, even the web isn’t big enough to contain JavaScript’s versatility: it’s now making its way into applications for the desktop.

Electron is a software development platform created by Github that lets developers use JavaScript along with other web technologies like HTML and CSS to create desktop applications that can run on Windows, Macintosh OS X, and Linux. Last year, Microsoft released a code editor called Visual Studio Code that was built using Electron. Why are all these companies using JavaScript when there are countless other ways to build desktop applications?

Open to Everyone Geeking Out on JavaScript. Untangling Spaghetti Code: Writing Maintainable JavaScript. This article was peer reviewed by Tom Greco, Dan Prince and Yaphi Berhanu. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! Almost every developer has had the experience of maintaining or taking over a legacy project. Or, maybe it’s an old project which got picked up again. Common first thoughts are to throw away the code base, and start from scratch. The code can be messy, undocumented and it can take days to fully understand everything. I’ve had to take over and clean-up a lot of projects. Analyse the Project The very first step is to get an overview of what is going on. Find out which tools are in use. jQuery? Understand the Project on a Higher Level Knowing the technologies is a good start, but to get a real feel and understanding, it’s time to look into the unit tests.

Create a Baseline This is all about establishing consistency. Coherent indentation Why is this even important? Naming Linting Everything Updating Dependencies Learn PHP for free! Refactoring a javascript video store. The simple example of calculating and formatting a bill for a video store opened my refactoring book in 1999. If done in modern Javascript, there are several directions you could take the refactoring. I explore four here: refactoring to top level functions, to a nested function with a dispatcher, using classes, and transformation using an intermediate data structure.

Many years ago, when I was writing the refactoring book, I opened the book with a (very) simple example of refactoring some code that calculated a customer's bill for renting some videos (in those days we had to go to a store to do that). I was contemplating this refactoring example recently, in particular how it would look if it were written in modern javascript. Any refactoring is about improving the code in a particular direction, one that suits a development team's coding style.

This initial video store code To explore further, I need to introduce some code. I'm using ES6 here. The movies structure looks like this classes. ES6 Modules. JavaScript Module Systems Showdown: CommonJS vs AMD vs ES2015. As JavaScript development gets more and more common, namespaces and dependencies get much more difficult to handle. Different solutions were developed to deal with this problem in the form of module systems. In this post, we will explore the different solutions currently employed by developers and the problems they try to solve.

Read on! Introduction: Why Are JavaScript Modules Needed? If you are familiar with other development platforms, you probably have some notion of the concepts of encapsulation and dependency. Encapsulation is essential to prevent conflicts and ease development. When it comes to dependencies, in traditional client-side JavaScript development, they are implicit. The following example is part of Backbone.js's examples. As JavaScript development gets more and more complex, dependency management can get cumbersome. JavaScript module systems attempt to deal with these problems and others. An Ad Hoc Solution: The Revealing Module Pattern Pros Cons CommonJS Implementations. What is the best way to learn JavaScript? - Quora. Learning ES6: Promises | Engineering Blog. Like clockwork the Learning ES6 series continues on, looking at promises. It will be the first feature we’ve looked at in this series that really is more than syntactic sugar.

But promises aren’t entirely new to JavaScript. They’ve existed for quite some time in helper libraries. ECMAScript 6 now brings native promise support to JavaScript via the Promise API. Let’s jump right in! A promise represents the eventual result of an asynchronous operation. Did you notice the use of default parameters and arrow functions too? Well you’ve come this far. Asynchronous programming background Because JavaScript originated as a programming language for the web, asynchronous programming has existed in it since its inception. Event handlers Event handlers are what I call the first generation of asynchronous programming in JavaScript.

This style is so old that it may actually be unfamiliar for some JavaScript developers. Callbacks Attempting to manage multiple active callbacks is also pretty complicated. A Practical JavaScript (ES6 and Beyond) Cheat Sheet by Toptal Developers | Toptal. ECMAScript 6 (ES6) is the latest standard specification of JavaScript, the programming language of the Web. Since HTML5 and the birth of Node.js, the runtime that allows us to run JavaScript on the server or desktop, JavaScript has gained a unique momentum.

There is a growing adoption rate among enterprises, embracing it into production, and thus its newest features were greatly awaited. We created this cheat sheet as a list of ES6 features we use everyday. Trying to be comprehensive but concise at the same time, new API methods are left apart. For those who need them, make a quick search by yourself or try to explore the MDN documentation to catch the latest experimental APIs. However, some the most bleeding edge characteristics like async and await from the next specification draft (ES7) are included. You can test out some of the mentioned tips by running the node REPL with this command: node --use-strict $(node --v8-options | grep harm | awk '{print $1}' | xargs) #ES6.

ES2015 - Let and Const. ES 2015: The next javascript version today - Roland Guijt. ES2015 in browser with Babel. Using ES6 today: The future of javascript has arrived - Wisdom Geek. Most of you would already be aware that javascript is an implementation of ECMAScript (ES). ES is the standardized language specification, and javascript is the dialect or the implementation. After the ES5 standardization in 2009, there were no updates to it. And since then, javascript has evolved a lot. It is no longer a scripting language that runs on the client side. Nor is it restricted to the web. Although ES7 is in draft status as of the time of writing this blog post, browsers are yet to implement all features of ES6. The key features introduced in es6 are: Block bindings (introducing let and const keywords)Rest and Default parametersClassesFunctional javascript (Arrow functions)DestructuringBuilt in Objects (Sets and Maps)Asynchronous Programming (Promises)ModulesGeneratorsTemplate Strings In this post, I will not get into the details about all these features.

Should I start using es6 now or wait? There is no simple yes/no answer to this question. Transpiling. Why Use Babel? | Introduction to Babel. What is Transpiling? | Introduction to Babel. Making ES6 happen with ChakraCore and Node - Christian Heilmann. Learning ES6: Classes | Engineering Blog. We’re going from enhanced object literals that look a lot like classes to actual classes in ES6. We’ll learn, however, that these aren’t really classes, but syntactic sugar over the existing prototype functions in JavaScript. Let’s continue on with the Learning ES6 series series! ECMAScript 6 provides syntactic sugar over the prototype-based, object-oriented pattern in JavaScript. ES6 classes provide support for constructors, instance and static methods, (prototype-based) inheritance, and super calls.

Instance and static properties are not (yet) supported. This is just a quick example of how ES6 classes work. Be sure to clone the Learning ES6 Github repo and take a look at the classes code examples page showing off the features in greater detail. The example also uses default parameters, rest parameters, and the spread operator so you may want to revisit the relevant articles if you’re not familiar. What’s all the fuss? Class declarations Let’s first talk about class declarations… Base class. ES6 Modules. Training on ES6 Features Array Prototype Methods. Training on ES6 Features Rest parameter and spread operator. Training on ES6 Features ES6 Classes. 210 JSJ The 80/20 Guide to ES2015 Generators with Valeri Karpov. JavaScript ES6 / ES2015 - [11] Generators. JavaScript ES6 / ES2015 - [10] Promises.

JavaScript ES6 / ES2015 - [09] Arrow Functions. JavaScript ES6 - WeakMaps. JavaScript ES6 - Proxy. JavaScript ES6 - Set. ES2015 Code Coverage and Jest (React JS Unit Testing) If you're new here, you may want to subscribe to my RSS feed. [fb-optin-form uid='' nofollow=false style='main' titletext='You can also get the feed via email. Sign up now by supplying your email address and clicking the Subscribe button' nonloggedonly=false] As I’ve mentioned before, I’m in the middle of putting together a React reference app and I’m doing it using Test Driven Development. The problem is, the standard tools for implementing ES2015 code coverage with Jest make it hard to see at a glance if you have 100% code coverage or not because of some issues with the way Jest tells Babel to do the transformations by default, the way Babel transforms the code and implements the auxiliaryCommentBefore option and the way that Istanbul parses the ignore next comments.

I’ve been working on solving this problem for the last month and a half off and on. I’ve even posted a question about this on Stack Overflow, so I’m pretty sure no one else has a solution for this yet. Diagnostics Quick fix: JavaScript ES6 / ES2015 - [07] Default Params & Spread Operator. JavaScript ES6 / ES2015 - [06] New String & Number Methods. JavaScript ES6 / ES2015 - [05] Template Literals. JavaScript ES6 / ES2015 - [04] Classes and Inheritance. JavaScript ES6 / ES2015 - [02] Compile ES6 With Babel. JavaScript ES6 / ES2015 - [01] Introduction. Javascript tagged template strings in ES6 (new string functions tutorial ) ES2015 Fat Arrow Functions—Josiah Krutz. ES6 Subclasses and Object.defineProperty - Art & Logic: Custom Software Development Company. (Photo by William Warby) Object.defineProperty provides a handy way to add properties to JavaScript objects. It’s been around for a while, but with the introduction of class syntax in ES6, it’s not immediately obvious how to use it to add properties to a class, as opposed to an instantiated object.

ES6 (now renamed ES 2015) adds syntactic sugar to support the appearance of traditional class inheritance. Now, rather than using prototypical inheritance directly, it’s possible to write code that looks more familiar when coming from other languages: In some cases, such as for data model classes, there might be a large number of properties. It can be helpful to define the property names and related metadata in a single data structure, then iterate over that data structure to create getters and setters. There’s duplicate, boilerplate code here, which creates a potential for bugs. Object.defineProperty to the rescue Object.defineProperty in ES6 subclasses The following two tabs change content below. Es6-promise. A lightweight library that provides tools for organizing asynchronous code This is a polyfill of the ES6 Promise.

The implementation is a subset of rsvp.js, if you're wanting extra features and more debugging options, check out the full library. For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. Downloads Node.js To install: npm install es6-promise To use: var Promise = require'es6-promise'Promise; Bower bower install es6-promise --save Usage in IE<9 catch is a reserved word in IE<9, meaning promise.catch(func) throws a syntax error.

However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production: promise'catch' Or use .then instead: promisethenundefined Auto-polyfill To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet: require'es6-promise'polyfill; Building & Testing npm install -g phantomjs.

Angular2: A TDD Intro In ES6 (1/3) ES6 + Webpack Setup | Visual Studio 2015. Better JavaScript with ES6, Pt. III: Cool Collections & Slicker Strings. Creating Modules in JavaScript with ES7 and BabelJscrambler Blog. Last year the new version of JavaScript was released and it gave us a lot of new goodies. Amongst those was syntax for importing and exporting of modules which finally codified “the only way” to do modules in JavaScript. Or well, eventually. Another nice thing is that it’s specced in such a way that you can statically analyze the whole module dependency tree. Pretty awesome. Let’s take a quick look at what they are: import v from "mod"; import * as obj from "mod"; import {x} from "mod"; import {x as v} from "mod"; import "mod"; export var v; export default function f(){}; export default function(){}; export default 42; export {x}; export {x as v}; export {x} from "mod"; export {x as v} from "mod"; export * from "mod"; So basically you can import the main value of a module (the “default”), or a specific property from explicit exports, a combination of this, or everything.

For ES7 there are some small additions proposed to extend this syntax. export * as ns from "mod"; export v from "mod"; #! 6 Things to Start with in ES6 (ECMA 6/ ES2015) - The New JavaScript. 20 - 25 mins read Moving to the new JavaScript At the time of this writing, ES6(aka ECMA 2015/ ES2015) is widely accepted and implemented across different platforms. JavaScript is now a mainstream language and it's all over the place. From application frontend to application backend, to databases, to platforms, to robotics (and much more), you can do it all in one universal language called "JavaScript".

Since the re-advent of JavaScript(jQuery days and others), it has evolved and emerged as a one-stop-shop for different kinds of applications and the popularity of this language has increased by leaps and bounds. ES2015 is the most extensive update to the language since it was first released in 1997. The current version of JavaScript is called ES6 or ES2015 released in June 2015. The 6 basic features we'll discuss are designed to make JavaScript code easier to read, write and also to avoid some of the strange behaviours JavaScript had in the past. 1. Let's understand "let" Welcome to "const" Learning ES6: Enhanced Object Literals | Engineering Blog. Wow, we’re making some good progress covering ECMAScript 6 features in this Learning ES6 series series. We most recently covered template literals and arrow functions. Now we zero in on the enhancements to object literals, another piece of ES6 syntactic sugar.

ECMAScript 6 makes declaring object literals even more succinct by providing shorthand syntax for initializing properties from variables and defining function methods. It also enables the ability to have computed property keys in an object literal definition. The enhanced object literals code examples page has many more examples showing off each feature in more detail. There are also some ES6 katas for testing your ES6 enhanced object literal knowledge. Continue on for more details! Introduction The object literal may very well be one of the best and most popular features in JavaScript.

We actually touched on object literals a little bit, while looking at object destructuring, but now we’ll be delving into their enhanced features. My 12 Favorite ES6/ES2015 Features — Capital One Developers. 1. Default Parameters in ES6 When we write modules, we need to account for cases when the arguments will be omitted. In other words, good modules must be smart enough to have default values for parameters. In ES5, you would write something like the code below, which uses the logical OR (||): var getAccounts = function(limit) { var limit = limit || 10 ...} These statements work well except for the edge cases.

Or maybe event an if/else condition to check for the undefined value: var getAccounts = function(limit) { if (typeof limit == 'undefined') limit = 10 ...} No more! This is not only uses fewer lines of code, but has increased readability as well. 2. If you have ever used or written a JavaScript function with a variable or even unlimited number of arguments you know the argument object. Function request(url, options, callback){ var args =, f.length); var url = args[0] var callback = args[2] // …} 3. Var name = 'Your name is ' + first + ' ' + last + '.' State of the JavaScript Landscape: A Map for Newcomers. Writing Next Generation Reusable JavaScript Modules in ECMAScript 6. 10 Javascript Aside ES6 Classes. 14 Modules and ES6.

Better JavaScript with ES6, Pt. II: A Deep Dive into Classes. Understanding The Babel 6 Compiler Tutorial. ES6 Symbols: Drumroll Please! | Blog | SitePen. ES6 module loading: More complicated than you think - NCZOnline. ES6+ code coverage with Babel plugin | Topheman JS. JavaScript ES6 Tutorial #11 - Generators. Gulp-es6. ES6 Succinctly · @kamran. Let's Learn ES2015. Let's Learn ES6. How to async in JavaScript. ES6features - What do you have to know about the current and next state of Javascript. ES6 Features | Chris Laughlin. GitHub - kensterz/interview-questions-in-javascript: A mostly reasonable collection of technical software development interview questions solved in Javascript. An early look at three high-impact ES6 features coming soon to Node.js. Introducing ES2015 Proxies | Web Updates - Google Developers. JS Rocks. Learn ES2015 · Babel. Read Understanding ECMAScript 6. ECMAScript 6 - ES6 Cheat Sheet by romansemko.

5 Tips To Improve Your JS with ES6 - Crater Conf Talk. JavaScript spread operator and rest parameters tutorial ES6 / ES2015. 6 reasons Web developers need to learn JavaScript ES6 now. Future of JavaScript & ECMAScript 6 (ES2015) Subclassable Built-ins & New Containers | Canadian Developer Connection. The most useful features of ES6/ES2015 | Front-End Insights. ES6 Arrow Functions in JavaScript tutorial ( Fat Arrow Function Expression es2015, ecma6) JavaScript Ecosystem | @ThingsExpo #IoT #JavaScript #TypeScript #Angular2 | Wearables. Exploring ES6 by Max Stoiber - Opbeat blog. GitHub - DimitriMikadze/es6-simple-starterkit: Simple to understand and use ES6 Starter Kit.

ES6 cheatsheet. WebPack Code splitting with ES6 and Babel 6. JavaScript Releases: ES2016 and Beyond. Start Using ES6/ES2015 In Your Project With Babel and Gulp - barbarian meets coding. All Aboard the ES6 JavaScript Train. Let's Learn ES6. Getting Started with ES2015 and Babel. ES6 Interactive Guide. Lukehoban/es6features: Overview of ECMAScript 6 features. ES6 Arrow Functions: The New Fat & Concise Syntax in JavaScript. Writing Next Generation Reusable JavaScript Modules in ECMAScript 6. ES2015 JavaScript JavaScript in 2016 - Language Enhancements - Telerik Developer Network.

Understanding-es6/ at master · sgaurav/understanding-es6. Exploring Real Time Apps with VueJS, ES2015 and Webpack. Sgaurav/understanding-es6 - JavaScript - GitHub. Bevacqua/es6. Top 10 ES6 Features Every Busy JavaScript Developer Must Know. ECMAScript 6 compatibility table.