網頁抓取工具 提供了幾種實用的方法來簡化數組的操作。 最簡單的是 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
數組。