We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functiongetTotalX(a,b){// Write your code hereletmin=a[a.length-1];// from the last element of array 1 letmax=b[0];// till the first element of array 2 letcount=0;//start looping through these valuesfor(leti=min;i<=max;i++){letallAreFactors=a.every(val=>i%val==0);letisFacotrToAll=b.every(val=>val%i==0);if(allAreFactors&&isFacotrToAll)count++;}return(count);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
JavaScript