Skip to content

Instantly share code, notes, and snippets.

@hillal20
Last active July 19, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hillal20/4f14d4d8a1a87672599b3fed3ee081fd to your computer and use it in GitHub Desktop.
Save hillal20/4f14d4d8a1a87672599b3fed3ee081fd to your computer and use it in GitHub Desktop.
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))
@hillal20
Copy link
Author

hillal20 commented May 7, 2020

first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment