Skip to content

Instantly share code, notes, and snippets.

@Underdoge
Created February 25, 2017 23:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Underdoge/ea151517d8f764c8a3327471f4341a7e to your computer and use it in GitHub Desktop.
Save Underdoge/ea151517d8f764c8a3327471f4341a7e to your computer and use it in GitHub Desktop.
commonCharacterCount
function commonCharacterCount(s1, s2) {
var string1=s1.split('');
var string2=s2.split('');
var common=0;
for(var i=0;i<string1.length;i++){
if(string2.indexOf(string1[i])>=0){
common++;
string2.splice(string2.indexOf(string1[i]),1);
}
}
return common;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment