Underscore.JS without方法 语法 _.without(array, *values)JavaScriptCopy without方法在从给定数组中删除值后返回一个数组。 示例 var _ = require('underscore'); var list = [1, 2, 3, 4, 5, 6] //Example 1: remove 5 result = _.without(list, 5); console.log(result) //Example 2: remove 5 and 6 result = _.without(list, 5, 6); console.log(result)JavaScriptCopy 将上述程序保存在 tester.js 中。运行以下命令来执行此程序。 命令 >node tester.jsJavaScriptCopy 输出 [ 1, 2, 3, 4, 6 ] [ 1, 2, 3, 4 ]JavaScriptCopy