Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Destructuring of object in ES6

function printBasicInfo({firstName, secondName, profession}) {
	console.log(firstName + ' ' + secondName + ' - ' + profession)
}

var person = {
  firstName: 'John',
  secondName: 'Smith',
  age: 33,
  children: 3,
  profession: 'teacher'
}

printBasicInfo(person)
Comment

object destructuring ES6

const person = {
    name: 'John',
    age: 34,
    hobbies: {
        read: true,
        playGames: true
    }
}
 
let {name, hobbies: {read, playGames}} = person;

console.log(person);
console.log(name);
console.log(read,playGames);
Comment

object destructuring ES6

let person = {
    name: 'John',
    age: 21,
    gender: 'male'
}

let { name, age, gender } = person;

console.log(name, age, gender);
Comment

destructure object exlude one

const myObject = {  a: 1,  b: 2,  c: 3};const { a, ...noA } = myObject;console.log(noA); // => { b: 2, c: 3 }
Comment

object destructuring ES6

let person = {
    name: 'John',
    age: 21,
    gender: 'male'
}

let { name : name1, age: age1, gender:gender1 } = person;

console.log(name1, age1, gender1);
Comment

PREVIOUS NEXT
Code Example
Javascript :: typescript obejct replace propertyies 
Javascript :: find cypress running in ci or open mode 
Javascript :: how to display data from json api using flutter expansiontile 
Javascript :: vuejs my chart load before fetch data 
Javascript :: javascript copy array map 
Javascript :: dojo create app 
Javascript :: The value associated with each key will be an array consisting of all the elements that resulted in that return value when passed into the callback. 
Javascript :: javascript variable declaration 
Javascript :: redux http library 
Javascript :: javascript conditional evaluation 
Javascript :: stopper un intervalle javascript 
Javascript :: preventive vs reactive 
Javascript :: How to check all checkboxes using jQuery? Ask Question 
Javascript :: aba translate js 
Javascript :: get image center pixels nodejs 
Javascript :: whait till src img has loaded angular 
Javascript :: ismodified function 
Javascript :: generate random rgb color javascript 
Javascript :: material ui notify 
Javascript :: chart js how padding will be set between ticks lables 
Javascript :: validate url javascript 
Javascript :: form to object function 
Javascript :: get all youtube playlist videos as json without api python 
Javascript :: how to use muliple calsse in miltiple file java script 
Javascript :: ${product} meaning in react js 
Javascript :: 3850 mod 17 
Javascript :: how to turn off auto refresh a href in javascript 
Javascript :: connecting , creating ,reading from mongo 
Javascript :: log errors react 
Javascript :: 10.8.1.2. The isPalindrome Function 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =