Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

array destructuring by using spread operator from a nested object in javascript

const person = {
    name: 'labib',
    age: 22,
    job: 'web-developer',
    frieds: ['ahsik', 'abir', 'alvi', 'hanafi'],
    childList: {
        firstChild: 'Salman',
        secondChild: 'Rafi',
        thirdChild: 'Anfi'
    }
}
const { frieds: [...a] } = person;
console.log(...a);
//Expected output:ahsik abir alvi hanafi
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js create or check directory 
Javascript :: Javascript function method with any number of arguments 
Javascript :: javascript string to boolean 
Javascript :: javascript switch statement 
Javascript :: palindrome string js 
Javascript :: how to write a function in javascript 
Javascript :: rename column infotable thingworx 
Javascript :: puppeteer waitforselector 
Javascript :: object method in javascript 
Javascript :: How to get a range numbers from given numbers in javascript 
Javascript :: Error: [Home] is not a <Route component. All component children of <Routes must be a <Route or <React.Fragment 
Javascript :: mongoose discriminator 
Javascript :: daysjs 
Javascript :: callback vs return 
Javascript :: #{} js 
Javascript :: browser.find_element_by_ <a 
Javascript :: create own rules jquery 
Javascript :: react google places auto complete example 
Javascript :: iis express gzip 
Javascript :: Min JavaScript Methods 
Javascript :: javascript event loop 
Javascript :: npm install save shortcut 
Javascript :: Repeat a String Repeat a String-Javascript 
Javascript :: /learn ES6: Use the Spread Operator to Evaluate Arrays In-Place 
Javascript :: javascript sort array by column 
Javascript :: js add fields to map 
Javascript :: filepond remove uploaded file 
Javascript :: webpack dev server 
Javascript :: react particles js 
Javascript :: animation end event angular 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =