Created
April 21, 2017 14:11
-
-
Save masterfermin02/316c0b86e85eafaad30e922dc298c96f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* @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