Tutorials Point, posted on 30th May, 2018

ES6 NumberIsFinite()

var res = Number.isFinite(10); 
console.log(res);

Tutorials Point, posted on 29th May, 2018

Generator Functions Two-Way Communication

function* ask() { 
   const name = yield "What is your name?"; 
   const sport = yield "What is your favorite sport?"; 
   return `${name}'s favorite sport is ${sport}`; 
}  
const it = ask(); 
console.log(it.next()); 
console.log(it.next('Ethan'));  
console.log(it.next('Cricket'));

Tutorials Point, posted on 29th May, 2018

ES6 Do-While Loop

var n = 10;   
do { 
   console.log(n); 
   n--; 
} 
while(n>=0); 

Tutorials Point, posted on 29th May, 2018

ES6 for Loop

"use strict" 
for(let temp, i = 0, j = 1; j<30; temp = i, i = j, j = i + temp) 
console.log(j);

Tutorials Point, posted on 29th May, 2018

ES6 for Loop

"use strict" 
for(let temp, i = 0, j = 1; j<30; temp = i, i = j, j = i + temp) 
console.log(j);

Tutorials Point, posted on 5th Dec, 2017

ES6 Custom Error with user-defined error message

function MyError(message) { 
   this.name = 'CustomError'; 
   this.message = message || 'Default Error Message';  
} try { 
   throw new MyError('Printing Custom Error message'); 
} 
catch (e) { 
   console.log(e.name);      
   console.log(e.message);  
}

Tutorials Point, posted on 5th Dec, 2017

ES6 Custom Error with default message

function MyError(message) { 
   this.name = 'CustomError'; 
   this.message = message || 'Error raised with default message'; 
} 
try { 
   throw new MyError(); 
} catch (e) {  
   console.log(e.name);      
   console.log(e.message);  // 'Default Message' 
}

Tutorials Point, posted on 5th Dec, 2017

ES6 Super Keyword

function notifyAll(fnSms, fnEmail) {   
   console.log('starting notification process');   
   fnSms();   
   fnEmail();   
}   
notifyAll(function() {   
   console.log("Sms send ..");   
}, 
function() {   
   console.log("email send ..");   
});   
console.log("End of script"); 
//executes last or blocked by other methods

Tutorials Point, posted on 5th Dec, 2017

ES6 Method Overriding

'use strict' ;
class PrinterClass { 
   doPrint() { 
      console.log("doPrint() from Parent called… ");
   }
}
class StringPrinter extends PrinterClass { 
   doPrint() { 
      console.log("doPrint() is printing a string…"); 
   } 
} 
var obj = new StringPrinter(); 
obj.doPrint();

Tutorials Point, posted on 4th Dec, 2017

ES6 Class Inheritance

'use strict';
class Shape { 
   constructor(a) { 
      this.Area = a;
   } 
} 
class Circle extends Shape { 
   disp() { 
      console.log("Area of the circle:  "+this.Area); 
   } 
} 
var obj = new Circle(223); 
obj.disp();

1 2 3 4 5 6 7 ... 32 Next
Advertisements
Loading...