function solution(board, moves) {
let answer = 0;
let arr = [];
for (let j = 0; j < moves.length; j++) {
for (let i = 0; i < board.length; i++) {
if (board[i][moves[j] - 1] === 0) continue;
else if (board[i][moves[j] - 1] !== 0) {
arr.push(board[i][moves[j] - 1]);
board[i][moves[j] - 1] += 0;
console.log(board);
break;
}
}
}
return arr;
}
console.log(solution([[0, 0, 0, 0, 0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]], [1,5,3,5,1,2,1,4]));
const Counter = (function () {
let num = 0;
return function increase() {
return ++num;
};
}());
const c = new Counter;