function func(num) { if (typeof num === "number") { console.log(num); } else { throw new TypeError(`必须是一个数组`) } } // 不能使用 try catch来捕获 console.log(func("lll"));