Array#-() is a Array class method which performs set difference operation by removing the similar elements of the two array.
Parameter: Arrays for performing the concatenation operation.
Return: New arrays by removing the same elements of the two arrays.
Example #1 :
difference of a and b : [18, 33, 6] difference of a and c : [4, 5] difference of b and c : [5, 4, 1, 88, 9]
Example #2 :
difference of a and b : ["abc", "xyz"] difference of a and c : ["abc", "xyz"] difference of b and c : ["cow"]
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.