Skip to content

Instantly share code, notes, and snippets.

@Hellodhakad
Created December 31, 2019 11:48
Show Gist options
  • Save Hellodhakad/e0792d8d035d7852b60fc4b74df7c2c4 to your computer and use it in GitHub Desktop.
Save Hellodhakad/e0792d8d035d7852b60fc4b74df7c2c4 to your computer and use it in GitHub Desktop.
function isomorphicString(str1, str2){
if(str1.length == str2.length){
var newMap = new Map();
for(let i=0; i< str1.length; i++){
let newKey = str1[i].toString();
console.log(newKey)
let mapValue = newMap.newKey;
if(mapValue){
console.log(mapValue)
if(mapValue == str2[i]){
continue;
}else{
console.log('Strings are not isomorphic!')
return false
}
}else{
newMap.str1[i] = str2[i];
}
}
}else{
console.log('Strings are not isomorphic!')
return false
}
}
isomorphicString('egg', 'add')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment