SOURCE

var searnmber = 9;//想要找出的数
var s = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
for (var i = 0; i < s.length - 1; i++) {//第一轮循环
    for (var j = 0; j < s.length - 1 - i; j++) {//第二轮
        if (s[j] + s[i] == searnmber) {
            console.log(s[j], s[i])
        }
    }
}
console 命令行工具 X clear

                    
>
console