1) How declare constant variable in ES6?

Use 'const' keyword instead of 'var' or 'let'. Constant variable can't be reassigned, however content on which it points could be changed. If you try to re-assigne constant variable following error wil be thrown: TypeError: Assignment to constant variable

2) What is blocked scoped variables?
Before ES6, in JS were exist only function scoped variables, which can cause some tricky to find errors. Therefore blocked scoped variables were introduced, they work like in C++ or Java. To declare block scoped variable use 'let' keyword instead of 'var'.
if(2+2){
  var functionScope='functionScope'
  let blockedScope='blockedScope'
}
console.log(functionScope)// 'functionScope'
console.log(blockedScope)// ReferenceError: blockedScope is not defined

3) What is arrow function? How it differ from usual function ?
 Arrow function is more compact version of ordinary JS function. 'function' key word is no more required to declare function, you just need use arrow => syntax.
[1,2,3].map(e=>e*2) // [2,4,6]
The main difference between arrow function and function expression is that, first doesn't have own: 'this',arguments,super. It's also known as lexical this.

4) How to set default parameters in JS?
The syntax is similar to other languages: argumentName = someValue.
function join(arr,separator=','){ return arr.join(separator)}


5) What is rest parameter?
 This argument aggregate all arguments passed after required arguments, previously some manipulation with 'arguments' array need to get this values, so this feature is very helpful.
function push(arr,elem,...otherElems){
  arr.push(elem);
  
  if(otherElems.length){
    otherElems.forEach(e=>push(arr,e))
  }
}

6) What is spread operator ?
Spread operator split collection into separate function arguments, this allow to call function which accepts three params, with one param.
const day = [2015, 10, 12];
const dayOff = new Date(...day);
let firstArray=[4,5,6]
let secondArray=[1,2,3,...firstArray] // [1,2,3,4,5,6]

7) How to use template string literal in ECMAScript 6? 
Just wrap string expression in 'some string' quotes ( grave accent). String expression allows to use variables inside them, this simply code, which use string concatenation to format. Also it is possible to create multiline temlates, '\n' is no needed now.
let user={'name':'John Doe',balance:0}
let message=`Hello ${user.name} your balance getting low. 
Balance: ${user.balance}`;

8) What new features were added to literal in ES6? 
Binary and octal literal is supported now. Unicode within strings and regular expressions support were extended.
console.log(0b100000000 === 256) //true
console.log(0o400 === 256) //true
console.log("ㅎ" === "\u{314E}") //true
console.log("ㅎ".codePointAt(0) == 0x314E) //true

9) What is property shorthands in object literals?
In ES6 variable name can be used as object key, it makes object declaration more compact.
let someVar=10;
let obj={name:'Test',someVar}

10) How to declare object with computed property name?
function generateId(){
  return Math.ceil(Date.now()+Math.random())+'';
}
let userIds={
  [generateId]:{name:'John Doe'}
}

11) What is destructuring assignment?

Destructuring is more compact and easy way to extract multiple values in single variables. There is object and array destructuring.
let user={firstName:'John',lastName:'Snow'}; //object destructuring 
let {firstName,lastName}=user;

let [users,orders]=await Promise.all([loadUsers(),loadOrders()]);
// instead of 
let results=await Promise.all([loadUsers(),loadOrders()]);
let users=results[0];
let orders=results[1];

12) How to define class in new OOP style?
class Rectangle{
  constructor(height,width){
    this.height=height;
    this.width=width;
  }
  getArea(){
    return this.height*this.width;
  }
}

13) How to extend some class in ECMAScript 6 ?
 

Use extends keyword. No more programmatic actions with prototypes required.
class Square extends Rectangle{
  constructor(height){
    super(height,height);
  }
}

14) How to access member of super class?
 

To call base class constructor just run super(). To call base class method or property use following syntax:
class Square extends Rectangle{
  constructor(height){
    super(height,height);
  }
  draw(){
    super.draw()
  }}

15) What is static members of class in ES6?

To declare static member function use 'static' keyword, such member function belongs to class, not to object. To call static member you need get it from class name: SomeClass.getInstance(); Unfortunately static properties still not available in current standard, so you need use TypeScript or write a hack.
class StaticTest{
  static  getInstance(){
    if(!StaticTest.instanse){
      StaticTest.instanse=new StaticTest();
    }
    return  StaticTest.prototype;
  }
}
console.log(StaticTest.getInstance())

16) How to export class in ES6?

 There is two types of export: named & default. To export class use following syntax:
class ExportedClass{}
export default ExportedClass;

//or
export {ExportedClass};

17) Implement zip array function in JS
Array.prototype.zip=function ( ...arrays){
   return this.map((val, i) => arrays.reduce((a, array) => [...a, array[i]], [val]));
}
console.log([1, 2, 3].zip([4, 5, 6])) //[[1, 4], [2, 5], [3, 6]]

18) What is typed array? Where is better to use it than ordinary array?

Types array allows to store raw binary data in order to improve performance. As you know ordinary arrays can store any data, and change size dynamically, consequently computing large amount of data take time. In recent years webapps became more complex, they need to work with video,audio data, handle WebSocket connections, so it's obvious that we need some way to handle binary data fast.

There is 4 classes of typed arrays: ArrayBuffer,Uint32Array,Uint8Array,Float32Array.


19) How to copy properties from one object to another in ES6?
 

Use Object.assign(dest,source1,{}) method, it copies all enumerable from one or more objects to dest object.
let dest={};
Object.assign(dest,{prop:'val'},{prop2:'val2'})// {prop:'val',prop2:'val2'}

20) How to find element in Array ?

 There are two new functions to search element of array: find and findIndex. Array.prototype.find() return first matched value in array, Array.prototype.findIndex() return index of first found value. If there is no such element undefined will be returned.
console.log([1,2,3,4,5].find(e => e > 4)) //5
console.log([1,2,3,4,5].findIndex(e => e > 4)) //4

21) What String.prototype.repeat() function do?
 

"some string".repeat(n) return string concatenated 'n' times.
console.log("TypeScript ".repeat(3)) // "TypeScript TypeScript TypeScript "


22) What new method to searching in string were added in ECMAScript 6?

  • String.prototype.startsWith() - determines whether string is started with specified substring.
  • String.prototype.endsWith() - determines whether string is ended with specified substring.
  • String.prototype.includes() - determines whether string contain specified substring.

All new methods have similar syntax, they have one required parameter - search string, and one optional - start index.

23)How to check whether number is NaN or finite?
 

In ES6 were introduced Number.isNaN and Number.isFinite methods.
console.log(Number.isNaN(NaN))//true
console.log(Number.isFinite(-Infinity))//true

24) How to use promise in ES6?
 

There is no transpilers or libraries required, ES6 support promises be default.

25) What is Proxy in ECMAScript6 ?

Proxy is a object which intercept access attempts for another object, and can modify them. Syntax:
let proxy = new Proxy(target, handler)