DEV Community

Discussion on: ES6 features you need to learn React

Collapse
 
grsahil20 profile image
Sahil

In the example above should you not do

function getPhoneNumber(addressBookObj) {
   return item.phoneNumber;
}

getPhoneNumber({name : 'John', age: 25, phoneNumber : 223344});

instead of

function getPhoneNumber(addressBookObj) {
   return addressBookObj.phoneNumber;
}

getPhoneNumber({name : 'John', age: 25, phoneNumber : 223344});

Otherwise item is undefined.

Collapse
 
tringakrasniqi profile image
Tringa Krasniqi

Ohh yeah, you're right! Initially it was 'item', so I missed it while editing the post. I will correct it now. Thanks for letting me know _^