js - How to change one key's value based on another key's value in array of objects

后端 未结 4 997
眼角桃花
眼角桃花 2021-01-29 05:01

I have an array of objects like this:

var chartData = [{count: 0, idTag: \"24\"}
                 {count: 0, idTag: \"25\"}
                 {count: 0, idTag: \"         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 05:38

    I would suggest using client side database storage mechanisms, and let the queries do the counting for you.

    This makes it more overseeable and reduces menory warnings from various virusscanners, plus you dont need to refetch data everytime.

    Another approach would be to use a server side database and retrieve the values you want via json.

    another aproach toprevent browser freeze is to let your loop run in a webworker so its a thread and doesnt lock the browser.

提交回复
热议问题