How WeChat Mini Programs modifies the value of data in traversal

data: {
    personData:[100,200,300,400,500,600]
},
onLoad: function(options) {
    this.Limit()
},
limit(){
    var _this=this;
      this.data.personData.forEach(item=>{
      if (item>400) {
        400
      }
   })
}

there is something I don"t quite understand when I just came into contact with WeChat Mini Programs, that is, I need to modify items greater than 400 in the above forEach. WeChat Mini Programs needs to call this.setData (), but gets the global content. How to use this to modify it as in js

Mar.07,2021

you can first save the processed value with a variable, reprocess it all, and then reassign the setData.

limit(){
    var _this=this;
    var temp = []
      this.data.personData.forEach(item=>{
      if (item>400) {
        temp.push(item) //400,setData
      }
   })
    this.setData({personData:temp})
}

this.setData({
    ["personData.0"]: "0"
})
Menu