abdur-rakib / es6-practice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ES6 Practice

let, const, var

  • var declarations are globally scoped or function scoped while let and const are block scoped.
  • var variables can be updated and re-declared within its scope; let variables can be updated but not re-declared; const variables can neither be updated nor re-declared.
  • They are all hoisted to the top of their scope but while var variables are initialized with undefined, let and const variables are not initialized.
  • While var and let can be declared without being initialized, const must be initialized during declaration.

Default Parameter

  • In JavaScript, function parameters default to undefined. However, it's often useful to set a different default value. This is where default parameters can help.
  • Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.

Template String

  • Template literals are enclosed by the backtick (``) (grave accent) character instead of double or single quotes.

Arrow Function

  • Arrow functions were introduced in ES6.
  • Arrow functions allow us to write shorter function syntax.

Spread Operator

Class

There are three concepts in Object-Oriented Programming Object, Class and Methods. The ES6 JavaScript supports the Object-Oriented programming components.

Null vs undefined

  • In JavaScript, undefined means a variable has been declared but has not yet been assigned a value.
  • null is an assignment value. It can be assigned to a variable as a representation of no value.
  • undefined is a type itself (undefined) while null is an object.

"==" vs "==="

  • == check the value only
  • === check the value and type

About


Languages

Language:JavaScript 100.0%