Size: a a a

2020 March 31

SP

Serg Petrov in pro.js
источник

DE

Denis Efremov in pro.js
источник

SP

Serg Petrov in pro.js
magic
источник

SP

Serg Petrov in pro.js
кинь код плиз
источник

DE

Denis Efremov in pro.js
function arrayDiff(a, b) {
 b.forEach((digit) => {
   while(a.includes(digit)) {
     const index = a.indexOf(digit)
     a.splice(index, 1)
   }
 })
 return a
}
источник

S

Syntax Highlight Bot in pro.js
Denis Efremov
function arrayDiff(a, b) {
 b.forEach((digit) => {
   while(a.includes(digit)) {
     const index = a.indexOf(digit)
     a.splice(index, 1)
   }
 })
 return a
}
источник

SP

Serg Petrov in pro.js
спасибо ,все ок,не посоветуешь похожий портал?
источник

K{

Kirill {} in pro.js
Serg Petrov
всем привет. Посмотрите где ошибка по возможности ,2 часа мучаюсь.function arrayDiff(a, b) {
    let sum;
         let sum2;

   sum=a.slice();
   a.sort(function (c, d) {
   return c - d;
});
   b.sort(function (e, f) {
   return e - f;

});

   sum.sort(function (e, f) {
   return e - f;

});
//     sum2=sum.sort(function (a, b) {
//     return a - b;
// });
//     b.sort(function (a, b) {
//     return a - b;
// });
 for(i=0;i<a.length;i++){
 
       for(l=0;l<b.length;l++){
           if(a[i]==b[l]){
        sum.splice(sum.indexOf(a[i]),1);
           // a.filter(item => item == a[i] );
   }
 }
 }
 // return sum
 console.log( a )  
   console.log( b )      
   
 console.log( sum )        

}


// arrayDiff([3,4], [2,3]);
// arrayDiff([1,8,2], []);
// arrayDiff([2,1,2,2,2,3],[2]);
// arrayDiff([-17,-7,12,10,-20],[-7,12,10,-17]);
arrayDiff([11,8,4,10,13,18,12,15,-11,4,-2,-2,-19,-8,-11,8,-13,-9,-18],[11,-19,4,15,-11,-13,8,-11,10,18,12,13,-2,-2]);
return a.filter(x => b.indexOf(x) == -1)
источник

DE

Denis Efremov in pro.js
function arrayDiff(a, b) {
 return a.filter((d) => !b.includes(d))
}
источник

S

Syntax Highlight Bot in pro.js
Denis Efremov
function arrayDiff(a, b) {
 return a.filter((d) => !b.includes(d))
}
источник

С

Славик in pro.js
Serg Petrov
Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result.

It should remove all values from list a, which are present in list b.

arrayDiff([1,2],[1]) == [2]

If a value is present in b, all of its occurrences must be removed from the other:

arrayDiff([1,2,2,2,3],[2]) == [1,3]
нет, что ты пытаешься сделать
источник

С

Славик in pro.js
а не задание
источник

SP

Serg Petrov in pro.js
понял,спасибо
источник

С

Славик in pro.js
у вас у обоих n^2
источник

DE

Denis Efremov in pro.js
Славик
у вас у обоих n^2
Покажи n
источник

С

Славик in pro.js
const set = new Set(arr1);
console.log(arr2.filter(v => !set.has(v)))
источник

С

Славик in pro.js
n + m
источник

SP

Serg Petrov in pro.js
Denis Efremov
Покажи n
Посоветуйте похожие порталы
источник

DE

Denis Efremov in pro.js
Славик
const set = new Set(arr1);
console.log(arr2.filter(v => !set.has(v)))
arrayDiff([1, 2, 2], [1])
источник

DE

Denis Efremov in pro.js
Serg Petrov
Посоветуйте похожие порталы
Зачем? Ты этот закончил?
источник