I am working with JavaScript and I am trying to know the length of values of a key. My thought is using forEach
but it is not working. What I mean is like knowing the number of values in audi (that will be 2. Ford will return 2. Kia will return 1). My dataset is below and thanks in advance:
const object1 = {
audi:
[ { make: 'audi', model: 'r8', year: '2012' },
{ make: 'audi', model: 'rs5', year: '2013' } ],
ford:
[ { make: 'ford', model: 'mustang', year: '2012' },
{ make: 'ford', model: 'fusion', year: '2015' } ],
kia: [ { make: 'kia', model: 'optima', year: '2012' } ] }