JSFiddle - React, Tailwind, and code Playground
by Qwerty_Wasd
JavaScript
let m = [
[1,2,3,4],
[-1,-2,-3,-4],
[1,2,3,4],
[-1,-2,-3,-4],
];
m.forEach(sub => sub.forEach(el => el > 0 ? 1 : 0));
console.log(m);
by Qwerty_Wasd
let m = [
[1,2,3,4],
[-1,-2,-3,-4],
[1,2,3,4],
[-1,-2,-3,-4],
];
m.forEach(sub => sub.forEach(el => el > 0 ? 1 : 0));
console.log(m);