What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-08 15:04:03
Javascript array get distinct objects
const categories = ['General', 'Exotic', 'Extreme', 'Extreme', 'General' ,'Water', 'Extreme'] .filter((value, index, categoryArray) => categoryArray.indexOf(value) === index); This will return an array that has the unique category names ['General', 'E... Add solution -
Java 2021-10-05 13:53:04
unordered list java
ArrayList abstracts the size management aspects of transitional Arrays. Check out: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#add(int,%20E) import java.util.ArrayList; public class Test<T> { ArrayList<T> yourArray; ... Add solution -
Javascript 2021-09-26 15:43:02
javascript remove duplicate in two arrays
// 1. filter() function removeDuplicates(array) { return array.filter((a, b) => array.indexOf(a) === b) }; // 2. forEach() function removeDuplicates(array) { let x = {}; array.forEach(function(i) { if(!x[i]) { x[i] = true } }) r... Add solution