DEV Community

Discussion on: JavaScript Code Daily Challenge #6

Collapse
 
lakshyatyagi24 profile image
Lakshya Tyagi
function getTotalX(a, b) {
    let validCount = 0;

    for (let x = 1; x <= 100; x++) {
        if (a.every(int => (x % int == 0))) {
            if (b.every(int => (int % x == 0))) {
                validCount++;
            }
        }
    }

    return validCount;
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Where'd you get the 100 from?

Collapse
 
lakshyatyagi24 profile image
Lakshya Tyagi

Open the link given in the question and check the constraints

Alt Text

Thread Thread
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Ah, I see. Well, you can still choose a smaller number though.