Having trouble with my code regarding functions

Solution solved thank you

Can you post your code formatted and a link to the exercise? To format press the button that looks like this:
</> and paste your code inside.

One can only assume this is intermediate code and there is more to the picture than presented at this stage of the problem. Here’s some sketch material derived from the examples…

const aCustomer = {
  id: '9',
  name: 'Joe Jackson',
  address: '1600 Dumaine St, Memphis, TN',
  telephone: '(494) 927-2152',
}
const print = x => console.log(x);
const retreiveIdProps = (obj, props) => {
  print (`id: ${obj.id}`)
  for (let x of props) {
    print (`${x}: ${obj[x]}`)
  }
}
retreiveIdProps(aCustomer, ['name', 'address', 'telephone'])
id: 9
name: Joe Jackson
address: 1600 Dumaine St, Memphis, TN
telephone: (494) 927-2152

Aside

Is this a classroom assignment? Be very careful how you adapt your code from the examples given. Your professor can find this online with a simple search. If not satisfied that you originated the given solution they could fail you. Learn from the advice given online and use it to stir your own creative juices.

1 Like