Advertisement
Guest User

Untitled

a guest
Jun 30th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const makeItFunny = (string, n) => {
  2.   let i = 0;
  3.   let result = '';
  4.   while (i < string.length) {
  5.     if ((i + 1) % n === 0) {
  6.       result += `${string[i].toUpperCase()}`;
  7.     } else {
  8.       result += `${string[i]}`;
  9.     }
  10.     i++;
  11.   }
  12.   return result;
  13. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement