Skip to content

Instantly share code, notes, and snippets.

@masterfermin02
Created April 21, 2017 14:11
Show Gist options
  • Save masterfermin02/316c0b86e85eafaad30e922dc298c96f to your computer and use it in GitHub Desktop.
Save masterfermin02/316c0b86e85eafaad30e922dc298c96f to your computer and use it in GitHub Desktop.
/*
* @param1 = string
* return boolean
*/
function isUniqueCharater(str){
return str.length === new Set(str).size;
}
/*
* @param1 = string
* return void
* if the str is unique charater print "all unique";
* else print "duplicates found"
*/
function printDupOrUni(str){
if(!isUniqueCharater(str))
console.log(str,' - duplicates found.');
else
console.log(str,' - all unique');
}
/**
*
* List for test the function
*
**/
const list = [
'hola mundo',
'hola mundss',
'hola sdd',
'testing',
'ja let ja',
'hello world',
'helo wrd',
'saerds dfs',
];
list.forEach(printDupOrUni);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment