scrimba
Note at 0:56
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 0:56
AboutCommentsNotes
Note at 0:56
Expand for more info
main.js
run
preview
console
function extractMatrixColumn(matrix, column) {
// write code here.
col = []
matrix.forEach( (list) => {
for(let i = 0; i < list.length; i++){
if(i==column){
col.push(list[i])
}
}
})
return col
}



/**
* Test Suite
*/
describe('extractMatrixColumn()', () => {
it('returns largest positive integer possible for digit count', () => {
// arrange
const matrix = [[1, 1, 1, 2], [0, 5, 0, 4], [2, 1, 3, 6]];
const column = 2;

// act
const result = extractMatrixColumn(matrix, column);

// log
console.log("result: ", result);

// assert
expect(result).toEqual([1, 0, 3]);
});
});
Console
"result: "
,
[
1
,
0
,
3
]
,
/index.html
LIVE