Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript of the object properties to a single variable

const person = {
    name: 'Sara',
    age: 25,
    gender: 'female'    
}

// destructuring assignment
// assigning remaining properties to rest
let { name, ...rest } = person;

console.log(name); // Sara
console.log(rest); // {age: 25, gender: "female"}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript for...of with Sets 
Javascript :: javascript setTimeout() method returns the interval id 
Javascript :: xhr.upload 
Javascript :: javascript Undeclared objects are not allowed 
Javascript :: JavaScript Generator Throw Method 
Javascript :: JavaScript Comparison and Logical Operators 
Javascript :: socket io join multiple rooms 
Javascript :: missing num 
Javascript :: simple counter with react hook 
Javascript :: Knockout js custom bindings 
Javascript :: How to add pop-up confirmation in angular typescript. 
Javascript :: switch javascript to java 
Javascript :: javascript equality operator 
Javascript :: Alternate capitalization 
Javascript :: phaser set x y 
Javascript :: phaser play animation after delay 
Javascript :: refresh secounds 
Javascript :: scan token deploy js 
Javascript :: reactjs moment to string 
Javascript :: why cant i add to object mongoose 
Javascript :: Get index of child elements with event listener in JavaScript 
Javascript :: javascript prompts user to input 
Javascript :: how to call function from another component in vue js 
Javascript :: codesandbox react emet 
Javascript :: javascript no decimal places 
Javascript :: material-ui add icon to switch when on 
Javascript :: javascript callback function 
Javascript :: spread operator es6 
Javascript :: best way to filter table in angular 
Javascript :: javascrip functions parameters 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =