Created
March 19, 2021 03:38
-
-
Save tofusoup429/7e8473623db3a5d983cb294e053db0eb to your computer and use it in GitHub Desktop.
This file contains 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
export const checkIfNoSameElementExistInArray = <T extends any>(_array:T[]):boolean => { | |
//return false if any overlapped value exist. | |
//return true if no same element exists. | |
let arrayLen:number = _array.length; | |
let set = new Set(_array); | |
let setLen = set.size; | |
return arrayLen === setLen | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment