js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Not above the one! #481

Closed RazvanBugoi closed 4 years ago

RazvanBugoi commented 4 years ago

https://www.codewars.com/kata/5b5097324a317afc740000fe/train/javascript

RazvanBugoi commented 4 years ago
function binaryCleaner(arr) {
  let smallerThanTwo = arr.filter((element) => element < 2);
  let indices = [];
  for (let i=0; i<arr.length; i++) {
    if (arr[i] > 1) indices.push(i);
  }
    return [smallerThanTwo, indices];
}