True path to become a JavaScript Ninja — II

Gaurav Mehla
Oct 2, 2017 · 7 min read
Image for post
Image for post
Courtesy from http://bit.ly/2hq4RJF

🔅 Lets continue to Practicing Phase

“ The difference between ordinary and extraordinary is practice. ”

⚜️ JavaScript Libraries & Frameworks

⚜️ Task Runners & Module Bundlers

Image for post
Image for post
This is exactly what webpack does

⚜️ Promises & Callbacks

Image for post
Image for post
function doSomething() {
return new Promise( function( resolve, reject ){
if( true ) {
resolve( 'success' );
} else {
reject( 'error' );
}
});
}
function onSuccess( response ) {
console.log( response );
}
function onError( error ) {
console.log( error );
}
var firstPromise = doSomething(); // It will return promise
firstPromise.then( onSuccess, onError );
Image for post
Image for post

⚜️ Arrow functions & Destructuring

var fun = function( a, b ) {
return a * b;
}
// Similar to above functionvar fun = ( a, b ) => a * b;
var a, b, rest;
[a, b] = [10, 20];
console.log(a); // 10
console.log(b); // 20

[a, b, ...rest] = [10, 20, 30, 40, 50];
console.log(a); // 10
console.log(b); // 20
console.log(rest); // [30, 40, 50]

({ a, b } = { a: 10, b: 20 });
console.log(a); // 10
console.log(b); // 20

.. That’s All… Its end of Second Phase ! …

About this post


Minions Army
Image for post
Image for post

_devblogs

Stories for Full-Stack Web developers which help them in…

Gaurav Mehla

Written by

Software engineer & Web hacker. Spent 30+% of life on playing with JS

_devblogs

_devblogs

Stories for Full-Stack Web developers which help them in pursuing their goals as a developer, mastering the modern web technologies and *hacking the web.

Gaurav Mehla

Written by

Software engineer & Web hacker. Spent 30+% of life on playing with JS

_devblogs

_devblogs

Stories for Full-Stack Web developers which help them in pursuing their goals as a developer, mastering the modern web technologies and *hacking the web.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store