1var singleNumber = function (nums) {2let s = 0; // Location of first possible suspect3for (let i = s + 1; i < nums.length; i++) {4if (nums[i] == nums[s]) {5// If we found a duplicate6nums.splice(i, 1); // Remove duplicate so it won't confuse us next time we come across it7s++; // Next suspect's location8i = s; // Start of next search (i=s+1 in next loop iteration)9}10}11return nums[s];12};