static/js/util.js
/**
 * Return the indices of elements that compares true in an array.
 * @function indexTrue
 * @param {Array} arr - input array
 * @returns {number} indices of true elements
 */
Return the indices of elements that compares true in an array.
@function indexTrue
@param {Array} arr - input array
@returns {number} indices of true elements
Return the indices of elements that compares true in an array . @function indexTrue @param { Array } arr - input array @returns { number } indices of true elements
function indexTrue(arr) {
  const n = arr.length;
  const res = [];
  for (let i = 0; i < n; i++) {
    if (arr[i]) res.push(i);
  }
  return res;
}
function indexTrue ( arr ) { const n = arr . length ; const res = [ ] ; for ( let i = 0 ; i < n ; i ++ ) { if ( arr [ i ] ) res . push ( i ) ; } return res ; }
Return the indices of elements that compares true in an array.
Return the indices of elements that compares true in an array .