Ad
  • Default User Avatar

    You don't use word[i] or word[j] in the loops, so you don't need for of. I'd just write for (let i = 0; i < word.length; i++) in this case.
    Make sure you declare local variables. i and j are global in your code.