2
* @param {number[]} nums13
* @param {number[]} nums26
var intersect = function (nums1, nums2) {7
// initialize empty array11
const nums1Sorted = nums1.sort((a, b) => a - b);12
const nums2Sorted = nums2.sort((a, b) => a - b);17
while (i < nums1Sorted.length && j < nums2Sorted.length) {18
// if nums1 index value is smaller than nums2 index value continue interating through nums119
if (nums1Sorted[i] < nums2Sorted[j]) {21
// if nums1 index value is larger than nums2 index value continue interating through nums222
} else if (nums1Sorted[i] > nums2Sorted[j]) {25
// if match found, push to result26
result.push(nums1Sorted[i]);