Advertisement
RosenPP

Untitled

Feb 28th, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.30 KB | Source Code | 0 0
  1. function distinctArr(arr) {
  2.  
  3.     let arrAsStr = arr.map(String);
  4.     let arrWithoutRepEl = [];
  5.  
  6.     for (let element in arr) {
  7.         element = arrAsStr[element];
  8.     } if (!arrAsStr.includes(element))
  9.         arrWithoutRepEl = arrAsStr.push(element).join(' ');
  10.  
  11.     console.log(arrWithoutRepEl);
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement