How to calculate sum of object keys in array - javascript

前端 未结 5 1208
甜味超标
甜味超标 2021-02-09 11:50

Question

I am working with firebase and react native.

I have returned an array from my firebase database that looks like this.

[Object, Object,         


        
5条回答
  •  故里飘歌
    2021-02-09 12:20

    Have you tried accessing the object in the array and calling the property?

    var array = [object, object, object];
    var sum = array[0].level + array[1].level + array[2].level;
    

提交回复
热议问题