Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js spread exclude property

//// EXCLUDE OBJECT PROPERTY USING THE spread OPERATOR ////

const firstObject = {id: 0, firstName: 'John', age: 77 };
// take every property except age:
const {age, ...secondObject} = firstObject;

console.log(firstObject);
console.log(secondObject);
// { id: 0, firstName: 'John', age: 77 }
// { id: 0, firstName: 'John' }
Comment

PREVIOUS NEXT
Code Example
Javascript :: how can we update time in react js 
Javascript :: how to get object keys and values in javascript 
Javascript :: javascript date pipe central timezone example 
Javascript :: compare two arrays and make sure there are no duplicates js 
Javascript :: javascript convert number to string with 2 decimal places 
Javascript :: strapi production build 
Javascript :: on click jqueyr 
Javascript :: Array.include is not a function javascript error help 
Javascript :: usestate with string 
Javascript :: var_dump in javascript 
Javascript :: Return certain fields with populate from mongoose 
Javascript :: get looping in jquery 
Javascript :: material ui textfield change input color 
Javascript :: performance.now() javascript 
Javascript :: sum of array elements in javascript 
Javascript :: mongoose find one and update with new field 
Javascript :: validate latitude longitude javascript 
Javascript :: jquery check if clicked outside div 
Javascript :: Scrollbar inside Dropdown of antD component React 
Javascript :: uncaught TypeError: $.jajax is not a function 
Javascript :: kb to mb js 
Javascript :: Arrays Comparison 
Javascript :: nextjs change port 
Javascript :: js element text color 
Javascript :: gulp run sequence 
Javascript :: javascript class constructor 
Javascript :: insert item into array specific index javascript 
Javascript :: check if function javascript 
Javascript :: luxon timestamp 
Javascript :: touppercase 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =