Challenge: Check If Arrays are Disjointed

We will learn how to check if two arrays are disjointed.

Problem Statement #

You have to implement the isDisjoint() function which checks whether two given arrays are disjointed or not. Two arrays are disjointed if there are no common elements between them. The assumption is that there are no duplicate elements in each array.

Input #

Two arrays of integers.

Output #

It returns true if the two are disjoint. Otherwise, it returns false.

Sample Input #

var list1 = [9,4,3,1,-2,6,5];
var list2 = [7,10,8];

Sample Output #

true

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.