const numbers = [1, 2, 2, 3, 4, 4, 5];
const uniqueNumbers = [...new Set(numbers)];
console.log('Unique Numbers:', uniqueNumbers);Remove Duplicates from Array Using Set
javascript
Related Posts
More content you might like
Code
javascript
JavaScript Remove Duplicates from an Array
No preview available for this content.
Jan 26, 2024
Read More Code
python
Remove Duplicates from a List
No preview available for this content.
Jan 26, 2024
Read More Code
python
Generate Fibonacci Sequence
def fibonacci(n):
if n <= 1:
return n
else:
return fibonacci(n-1) + fibonacci(n-2)
result = [fibonacci(i) for i in range(10)]
print('Fibonacci Sequence:', result)Jan 26, 2024
Read MoreDiscussion 0
Please sign in to join the discussion.
No comments yet. Be the first to share your thoughts!