Assign Const Value in JavaScript

avatar
Published: Mar 16, 2022 - Updated: Mar 23, 2022

You can easily assign any const value in JavaScript without called each value.

const user = {
  name: 'imnhasan',
  email: '[email protected]'
}
// instead if this
const name = user.name;
const email = user.email;

// you can use this
const {name, email} = user;