Counting Occurrences of Object Values

前端 未结 2 2045
刺人心
刺人心 2021-01-03 10:11

I am trying to loop through some data in a JSON file and count the number of same cities/occurrences...

var json = [
  { \"city\": \"California\" },
  { \"ci         


        
2条回答
  •  -上瘾入骨i
    2021-01-03 10:26

    Nevermind, long day.

    I noticed I forgot to access the property city

    The Fix: obj[json[i].city]

    Thanks!

提交回复
热议问题