Isomorphic Strings LeetCode solution in JavaScript
1/**2* @param {string} s3* @param {string} t4* @return {boolean}5*/6var isIsomorphic = function (s, t) {7const obj = {};8const setValues = new Set();9let isIso = true;1011for (var indexI = 0; indexI < s.length; indexI++) {12if (obj[s[indexI]] || setValues.has(t[indexI])) {13if (obj[s[indexI]] === t[indexI]) continue;1415isIso = false;16break;17} else {18obj[s[indexI]] = t[indexI];19setValues.add(t[indexI]);20}21}2223return isIso;24};