JSFiddle - React, Tailwind, and code Playground
JavaScript
var singleNumber = function(nums) {
var hash = {}
for(var i=0;i<nums.length;i++)
if (hash.hasOwnProperty(nums[i]))
delete hash[nums[i]]
else
hash[nums[i]] = { value:nums[i], type: typeof nums[i]};
for(var x in hash)
return hash[x];
}
result = singleNumber(['123',123,'23']);
console.log(result);
console.log(result.value + ' type:' + result.type);
result = singleNumber(['123',123,23]);
console.log(result.value + ' type:' + result.type);