We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22fb6f4 commit ca3800aCopy full SHA for ca3800a
libs/array_lib.js
@@ -167,19 +167,21 @@ const extractDigits = function(number){
167
168
const unique = function(list){
169
let result = [];
170
- for(let element of list){
+ list.forEach(function(element){
171
let isAlreadyPresent = result.includes(element);
172
if(!isAlreadyPresent){
173
result.push(element);
174
}
175
- }
+ });
176
return result;
177
178
179
// get Union set for two given sets
180
const union = function(firstSet, secondSet){
181
let unionSet = firstSet.slice();
182
- secondSet.forEach(function(element){ unionSet.push(element);});
+ secondSet.forEach(function(element){
183
+ unionSet.push(element);
184
185
return unique(unionSet);
186
187
0 commit comments