Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js duplicate

let chars = ['A', 'B', 'A', 'C', 'B'];

let uniqueChars = [];
chars.forEach((c) => {
    if (!uniqueChars.includes(c)) {
        uniqueChars.push(c);
    }
});

console.log(uniqueChars);
Code language: JavaScript (javascript)
Source by www.javascripttutorial.net #
 
PREVIOUS NEXT
Tagged: #js #duplicate
ADD COMMENT
Topic
Name
4+9 =