---
# System prepended metadata

title: ES6 features

---

# ES6 features

# Classes
ES6 introduced classes.

A class is a type of function, but instead of using the keyword function to initiate it, we use the keyword class, and the properties are assigned inside a constructor() method.

# Example

class Car {
  constructor(name) {
    this.brand = name;
  }
}
We have begun the name, "Car", with an uppercase character.


# Spread operator
work on array and object
copy exiting array or object.

var arr = [1,2,3];
var arr2 = [...arr, 4];
result= [1,2,3,4];

# Rest operator
var arr = [1,2,3,4,5];
var arr3 = [1,2, ...args];
rest operator not work in starting.only work in end elements.

# Arrow function

const xyz =() =>{

}

# Ternary Operator
var x = `hello ${name}` 


