rodpoblete
12/1/2017 - 2:58 AM

Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capit

Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capital letters in the string.

// Instructions

// Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capital letters in the string.

// Test.assertSimilar( capitals('CodEWaRs'), [0,3,4,6] );

const capital = function(word) {
  const arr = word.split("");
  const arrOrdened = arr.map(function(e, i, a) {
    if (e === e.toUpperCase()) {
       return i;
    }
  });
  console.log(arrOrdened);
};

capital("CodEWaRs");