Бомж-стайл вариант:
function f(ar){
let res = [0];
ar.forEach( n => typeof n == 'number' && typeof res[ res.length - 1 ] == 'number' ? res[ res.length - 1 ] += n : res.push(n) );
return res.join('').replace( /^0/, '' );
}
console.log( f( [1, 1, 'Q', 1, 'R'] )); //2Q1R
console.log( f( [1, 1, 1, 'Q', 1, 1, 'R', 1] ) ); // 3Q2R1
console.log( f( [1, 1, 'N', 'W', 1, 1, 1, 'Q'] ) ); // 2NW3Q
/*****/
console.log( f( [1, 11, 'N', 'W', 3, 55 , 0, 'Q'] ) ); // 12NW58Q
console.log( f( ['A', 1, 21, 'N', 'W', 3, 55, 0, 'Q', 4] ) ); // A22NW58Q4
console.log( f( ['A','CDE', 1, 21, 'N', 'W', 3, 'Q', 4] ) ); // ACDE22NW3Q4