This is the solution I came up with in JavaScript.

```
var twoSum = function(nums, target) {
for (var i = 0; i < nums.length; i++) {
var diff = target - nums[i],
temp = nums[i],
found;
nums[i] = null;
found = nums.indexOf(diff);
if(found > -1)
return found+1 < i ? [found+1, i+1] : [i+1, found+1];
nums[i] = temp;
}
return;
}
```