“Entfernen Sie Duplikate Strig JavaScript” Code-Antworten

JavaScript entfernen Sie doppelte Buchstaben in einer Zeichenfolge

function removeDuplicateCharacters(string) {
  return string
    .split('')
    .filter(function(item, pos, self) {
      return self.indexOf(item) == pos;
    })
    .join('');
}
console.log(removeDuplicateCharacters('baraban'));
Yawning Yak

Entfernen Sie Duplikate Strig JavaScript

const arr = [1, 2, [3, 4]];

// To flat single level array
arr.flat();
// is equivalent to
arr.reduce((acc, val) => acc.concat(val), []);
// [1, 2, 3, 4]

// or with decomposition syntax
const flattened = arr => [].concat(...arr);

Entfernen Sie Duplikate Strig JavaScript

const arr = [1, 2, [3, 4]];

// To flat single level array
arr.flat();
// is equivalent to
arr.reduce((acc, val) => acc.concat(val), []);
// [1, 2, 3, 4]

// or with decomposition syntax
const flattened = arr => [].concat(...arr);

Entfernen Sie Duplikate Strig JavaScript

const arr = [1, 2, [3, 4]];

// To flat single level array
arr.flat();
// is equivalent to
arr.reduce((acc, val) => acc.concat(val), []);
// [1, 2, 3, 4]

// or with decomposition syntax
const flattened = arr => [].concat(...arr);

Ähnliche Antworten wie “Entfernen Sie Duplikate Strig JavaScript”

Fragen ähnlich wie “Entfernen Sie Duplikate Strig JavaScript”

Weitere verwandte Antworten zu “Entfernen Sie Duplikate Strig JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen