网页抓取工具 提供了几种实用的方法来简化数组的操作。 最简单的是 contains
下面演示的方法。 如果要搜索的数组包含指定值,则此方法将返回true。
var items = [1,2,3,4]; if (Utility.Array.contains(1, items)) { //this code will be executed because the items array contains a 1. }
上面的方法将执行包含在 if
语句,如果1包含在 items
数组。