SHARE
TWEET

Algorythm task

a guest Sep 22nd, 2019 78 in 153 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isPrime(num) {
  2.   if (num < 2) return false;
  3.   for (var i = 2; i < num; i++) {
  4.     if (num % i == 0) return false;
  5.   }
  6.   return true;
  7. }
  8.  
  9. function makeArrC(arrayA, arrayB) {
  10.   const arrayC = arrayA.filter(arrayItemA => {
  11.     let numberCount = 0;
  12.  
  13.     arrayB.forEach(arrayItemB => {
  14.       if (arrayItemB === arrayItemA) numberCount++;
  15.     });
  16.     return !isPrime(numberCount);
  17.   });
  18.   return arrayC;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top