Js code optimization

often encounter this kind of code that needs to be transformed. How can it be optimized to the most concise?

  let arr = res.data.class;
  for (let i = 0; i < arr.length; iPP) {
    if (arr[i].stats == 0) {
      arr[i].stats = false;
    } else if (arr[i].stats == 1) {
      arr[i].stats = true;
    }
    
    // , , ?
    // arr[i].stats == 0 ? false :  = true;
    // arr[i].stats == 0 ? (arr[i].stats = false) : (arr[i].stats = true);
  }
Nov.16,2021

according to the meaning of the topic:

  

arr.forEach (function (item) {item.stats});

Menu