Closed RazvanBugoi closed 4 years ago
const findAll = (array, n) => {
let indices = [];
let idx = array.indexOf(n);
if (!array.includes(n)) {
return indices;
} else {
while(idx != -1) {
indices.push(idx);
idx = array.indexOf(n, idx + 1);
}
return indices;
}
}
Can we go over this solution together and explain me what's happening there ? I have solved this kata following an example from dev.docs but I am not sure I understand entirely what's going on there.
https://www.codewars.com/kata/59a9919107157a45220000e1/train/javascript