I am trying to access certain key value for objects nested inside an array.
When I try to do that with
filter(x => x.key('duration'));
I get .key is not a function.
Here I want to access the values of keys "duration" within the objects of the array:
'use strict';
const monday = [
{
name: 'Write a summary HTML/CSS',
duration: 180,
},
{
name: 'Some web development',
duration: 120,
},
{
name: 'Fix homework for class10',
duration: 20,
},
{
name: 'Talk to a lot of people',
duration: 200,
},
];
const tuesday = [
{
name: 'Keep writing summary',
duration: 240,
},
{
name: 'Some more web development',
duration: 180,
},
{
name: 'Staring out the window',
duration: 10,
},
{
name: 'Talk to a lot of people',
duration: 200,
},
{
name: 'Look at application assignments new students',
duration: 40,
},
];
const maartjesTasks = monday.concat(tuesday);
const maartjesHourlyRate = 20;
console.log(maartjesTasks);
```js
x.key('duration')item "x" has no "key" method since it's an object. Just usex.durationorx['duration'].