functionfirstNonRepeatingCharacter(str) {constmemo= {}for (let i =0; i <str.length; i++) {constc= str[i];if (memo[c] ===undefined) memo[c] =0; memo[c] +=1; }for (let i =0; i <str.length; i++) {constc= str[i];if (memo[c] ===1) return i; }return-1;}// Do not edit the line below.exports.firstNonRepeatingCharacter = firstNonRepeatingCharacter;