I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc
i want the result to be abc
. so far my function works like this:
function unique_char(string) {
var unique = '';
var count = 0;
for (var i = 0; i < string.length; i++) {
for (var j = i+1; j < string.length; j++) {
if (string[i] == string[j]) {
count++;
unique += string[i];
}
}
}
return unique;
}
document.write(unique_char('aaabbbccc'));
The function must be with loop inside a loop; that's why the second for
is inside the first.
if you want to return values in a array you can use this below function.
const getUniqueChar=(str)=>str.split('').filter((item, index, arr)=>
arr.slice(index+1).indexOf(item)===-1);
console.log(getUniqueChar("aaabbbccc"));
OR
You can use Set constructor
cosnt getUniqueChar=(str)=>
new Set(str.split(''));
console.log(getUniqueChar('aaabbbccc'));
let unique=myArray.filter((item,index,array)=>array.indexOf(item)===index)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.