static/js/util.js
/**
 * Return the number of elements that compares true in an array.
 * @function countTrue
 * @param {Array} arr - input array
 * @returns {number} number of true elements
 * @description Useful to check how many contigs are set in `picked`, `masked`
 * and `binned` arrays. The same result can be achieved using arr.filter(
 * Boolean).length, but I guess that this function is faster.
 */
Return the number of elements that compares true in an array.
Return the number of elements that compares true in an array .
function countTrue(arr) {
  const n = arr.length;
  let res = 0;
  for (let i = 0; i < n; i++) {
    if (arr[i]) res++;
  }
  return res;
}
function countTrue ( arr ) { const n = arr . length ; let res = 0 ; for ( let i = 0 ; i < n ; i ++ ) { if ( arr [ i ] ) res ++ ; } return res ; }
Return the number of elements that compares true in an array.
Return the number of elements that compares true in an array .