/**

@param {number[]} nums

@param {number} target

@return {number[]}
**/
var twoSum = function(nums, target) {var result = new Array(0);
//test the nums after the flag
for (var i in nums){
var n= i+1;
var temp = 0;
//length === 1
if ( nums.length === 1){
return;
}
do{
temp = nums[i] + nums[n];
if ( target === temp ){
result.push(i, n);
}
n += 1;
}while (n <= nums.lentgh);}
return result;
};
Your input
[2,4]
6
Your answer
[]
Expected answer
[0,1]
I don't know what's wrong with this?
someone can help me.?