Skip to content

Instantly share code, notes, and snippets.

View bluevivid's full-sized avatar

Mike Freitag bluevivid

View GitHub Profile
function mapDiagonal(arr){
var row_mapper = Array.from({length: arr.length}, (v, i) => i),
col_mapper = Array.from({length: arr[0].length}, (v, i) => i),
_mapper = row_mapper.map(val => col_mapper.map(_val => [val,_val]));
_mapper = _mapper.reduce((acc,cur)=>{
acc = acc.concat(cur)
return acc;
}, [])