function detectStraightLining(formArray) {

    // Initialize counts
    let counts = [];

    // Count number of instances per unique response
    for (let i = 0; i < formArray.length; i++) {
      let loc = parseInt(formArray[i]['position']);
      if ( counts[loc] > 0 ) {
        counts[loc]++;
      } else {
        counts[loc] = 1;
      }
    }

    // Error-catching: replace empty with zero.
    counts = Array.from(counts, item => item || 0);

    // Compute and return maximum fraction
    return Math.max(...counts) / formArray.length;

  }
// percentage of responses loading onto the same item position.
percentage of responses loading onto the same item position.
percentage of responses loading onto the same item position .
function detectStraightLining(formArray) {
    let counts = [];
    for (let i = 0; i < formArray.length; i++) {
      let loc = parseInt(formArray[i]['position']);
      if ( counts[loc] > 0 ) {
        counts[loc]++;
      } else {
        counts[loc] = 1;
      }
    }
    counts = Array.from(counts, item => item || 0);
    return Math.max(...counts) / formArray.length;
  }
function detectStraightLining ( formArray ) { let counts = [ ] ; for ( let i = 0 ; i < formArray . length ; i ++ ) { let loc = parseInt ( formArray [ i ] [ 'position' ] ) ; if ( counts [ loc ] > 0 ) { counts [ loc ] ++ ; } else { counts [ loc ] = 1 ; } } counts = Array . from ( counts , item => item || 0 ) ; return Math . max ( ... counts ) / formArray . length ; }
percentage of responses loading onto the same item position.
percentage of responses loading onto the same item position .
// Initialize counts // Count number of instances per unique response // Error-catching: replace empty with zero. // Compute and return maximum fraction