const arr = [2,11, 7, 15];
const target = 9;
var twoSum = function(nums, target) {
let sortArr = nums.sort((a, b) => a - b);
console.log(sortArr)
for (let i = 0; i < sortArr.length; i++) {
for (let j = i + 1; j < sortArr.length; j++) {
if (nums[i] + nums[j] === target) {
return ([i, j])
}
}
}
};
twoSum(arr, target);