var twoSum = function(nums, target) {
let history = [];
for(let i=0; i< nums.length; i++){
let diff = target - nums[i]; //I get the difference I need to find in history.
let existIndex = history.indexOf(diff); //Get index if exist or -1
if(existIndex != -1)
{
return [existIndex, i]; //if exists, return index and current index.
}
history.push(nums[i]);
}
};