var sumDigit = function(nums, target) {
const indexArr = [];
let i = 0
while(true) {
const current = nums[i];
const j = indexArr[current];
if(j !== undefined) return [i, j];
indexArr[target - current] = i;
i++
}
};
sumDigit([3,2,4], 6)