scrimba
Javascript Hacks with ES6-ES7
JavaScript Hack with ES6 -ES7 #14
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

JavaScript Hack with ES6 -ES7 #14
AboutCommentsNotes
JavaScript Hack with ES6 -ES7 #14
Expand for more info
index.js
run
preview
console


var object = {
a : 50,
b: 60
}
var x = JSON.parse(JSON.stringify(object));
console.log(x);

// timer methods from web API

setTimeout(function(){
console.log('after 5 sec');
}, 5000);

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(this.readyState == 4){
clearTimeout(timeout);
}
}
var timeout = setTimeout (function(){
xhr.abort();
}, 2000);

xhr.open('GET', url, true);
xhr.send();

//----------------------------------------------//

function hello(a,b) {
return a+b;
}

function add(a){
return function(b){
return function(c){
return a+b+c;
}
}
}
add(4)(5)(8);

var x = add(4);
var y = x(5);
var z = y(8);












Console
{a:
50
, b:
60
}
,
"after 5 sec"
,
index.html
-5:17