0
隨着this thread幫助下,我得到了下面的一段代碼,其中發現的話所有出現至少3個字母:只獲得了比賽,而不是整體進入
arr = ["ab", "abcdef", "ab test"]
var AcceptedItems = arr.filter(function(item) {
return item.match(/[a-zA-Z]{3,}/);
});
在我的情況,應該是abcdef
和test
。
但是,不僅僅是發生,它讓我的數組的整個條目。所以,而不是隻是test
它得到我ab test
。
我怎樣才能得到匹配(test
),而不是整個數組條目。
'arr.map(item.match .... [0])。filter(Boolean)'' – georg