I have an array with items like:
[[ 'NAME 1',30 ]
[ 'NAME 2',120 ],
[ 'NAME 3', 90 ],
[ 'NAME 4',30 ]]
For example, I need to take sum from this array as 60, so in array it is the first and the last element.
How can I do it in node.js?
Summary: I have an array, from array I need to take x as sum value ( x is number like 90, 100). If the target number already exists in the array, that number is the result. If it does not exist, the combination of numbers should be returned, with the numbers in the combination should be as few as possible.