.firstMethod()
.secondMethod()
.thirdMethod();
/**************************************************** */
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);
/************************************************* */
var keywords = ["do","if","else","for" ,"switch"];
keywords
.filter( i => i.length > 3 )
.map( i => i.concat('Hi') )
.sort( (a,b) => a < b ? -1 : 1);
/************************************************ */
class ChainAble {
firstMethod() {
console.log('This is the First Method');
return this;
}
secondMethod() {
console.log('This is the Second Method');
return this;
}
thirdMethod() {
console.log('This is the Third Method');
return this;
}
}
const chainableInstance = new Chainable()
chainableInstance