On Github rjanardan / js-the-new-parts
arrow functions, array functions, string functions, for..of, function parameters, parameters with default values, variable parameters, destructuring, template strings
Math library, new data structures - Maps, Sets, WeakMaps, WeakSets
Presentation template from John K Paul @johnkpaul
String.raw`` String.prototype.repeat() String.prototype.startWith() String.prototype.endsWith()
//Without arrow function
var std = function std(yr) {
  return "ECMAScript" + yr;
};
//With arrow functions
var std = yr => "ECMAScript"+yr;
//Return an object
let makept = (a, b) => ({ x:a, y:b});
		  
        
0b111 // 7 (decimal)
              
0b11+0o11 // 12 (3+9)
		  
		
for (let i = 0; i < 3; i++) {
  console.log('iterator ' + i);
}
console.log('iterator ' + i++); // error
		  
        const version = 6; console.log(version); version = 7; // error
{
const version = 6;
console.log(version);
}
version = 7; // error
		  
        
let firstname = "Janardan",
    
  lastname = "Revuru",
  organization = "HPE EG India R&D";
let employee = {                       let employee = {
                                      
  firstname: firstname,                   firstname,
                                      
  lastname: lastname,                     lastname,
                                      
  organization: organization              organization
                                      
};                                    };
                                         (new notation)
                  
let employee = {
    firstname,
    lastname,
    org: organization,
    location: "Mahadevapura"
};  
                  
let payroll = {
  _employees: [],
       print() {                       
        console.log(JSON.stringify(employee));
      }
};
payroll.print();
        
let i = 0;
              
let std = "ecma";
let fn = "print";
let obj = {
  ["js" + ++i]: i,
  ["js" + "2"]: ++i, 
  ["js" + new Date().getFullYear()]: 10,
  [std]: 20,
  [fn]: function() { console.log("hello!"); },
};
          
                  
 Number.isFinite(3); // true
 Number.isFinite('3'); // false
 isFinite('3'); // true
 Number.EPSILON
 (0.21+0.2) !== (0.41)
 Number.MIN_SAFE_INTEGER
 Number.MAX_SAFE_INTEGER
 Number.isSafeInteger()
                  
function fn(one, two, three) {
  console.log(one, two, three);
}
fn(1);
                  
function simple_interest(p, t, r) {
  let time = t || 1;
  let rate = r || 8;
  let si = (p * time * rate)/100;
  console.log("p =" + p + ", t = "+ time + 
      ", r = "+rate + "; si = " + si);
}
simple_interest(1000, 5);
simple_interest(1000, 2, undefined);
simple_interest(1000, 2, null);
simple_interest(1000, 2, 0);
        Array.prototype.includes()
Exponentiation operator
SIMD.js
Async functions
Object.values/Object.entries
String padding
Object.getOwnPropertyDescriptors
          
function add(...nums) {
  var result = 0;
  nums.forEach(function (num) {
  result += num;
  });
  return result;
}
add(10, 20, 30, 50);
                  
function max(a, b, c) {
    // code to find max of three numbers
}
let a = [10, 20, 30];
max(...a); // = max(10, 20, 30)
let b = [...a, 40, 50];
                  
 let arr = ["mon", "tue", "wed"];
 for (let i in arr) {
    console.log(i); //prints index
 }
 for (let i of arr) {
     console.log(i); //prints values
 }
 for (let [i,v] of arr.entries()) {
   console.log(i, ": ", v); // prints index, values
}
                  
const distro = {
  name: 'Linux Mint',
  os_type: 'linux',
  based_on: ['debian', 'ubuntu'],
  origin: 'Ireland',
  arch: ['i386', 'x86_64'],
  popularity: 1
};
let { name: name, origin: origin } = distro;
          
let today = new Date();
let UTCstring = today.toUTCString();
let [, date, month, year] =    
           today.toUTCString().split(" ");
        let matrix = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]; let [[a11,,],[,a22,],[,,a33]] = matrix; // swapping elements let [a, b] = [1, 2]; [a, b] = [b, a];
  
const books = [
  { t: "Eloquent JavaScript",
    a: "Marijn"
  },
  { t: "Exploring ES6",
    a: "Alex"
  }];  
for (let {t} of books) { 
  console.log(t);
}
          
function get_rank({popularity: p}) {
	return p;
}
const distro = {
  name: 'Linux Mint',
  os_type: 'linux',
  popularity: 1
};
get_rank(distro);