Last active
July 19, 2020 23:40
-
-
Save hillal20/4f14d4d8a1a87672599b3fed3ee081fd 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
et string = "abcfed"; | |
let splited = string.split(''); | |
let str2 = ""; | |
let str1 = "" ; | |
let str3 = ""; | |
const obj = {}; | |
for(let i = 0; i < splited.length ; i++){ | |
str1 += splited[i] | |
obj[splited[i]] = true; | |
obj[str1] = true; | |
for(let b = i+1 ;b < splited.length; b++){ | |
str2 = splited[i] + splited[b] ; | |
str3 += splited[b]; | |
obj[str2] = true; | |
obj[str3]= true; | |
} | |
str3=""; | |
} | |
console.log(Object.keys(obj)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
first