亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

JavaScript String includes() 方法

 JavaScript String 對(duì)象

includes()方法判斷一個(gè)字符串是否可以在另一個(gè)字符串中找到。

如果字符串包含字符,includes()方法將返回true,否則返回false

注意:此方法區(qū)分大小寫。

語法:

string.includes(searchValue, start)
var str = 'Air Pollution is introduction of chemicals to the atmosphere';
str.includes('Pollution');   // true
測(cè)試看看?/?

瀏覽器兼容性

表格中的數(shù)字指定了完全支持include()方法的第一個(gè)瀏覽器版本:

方法
includes()4140912

參數(shù)值

參數(shù)描述
searchValue(必需)在此字符串中搜索的字符串
start(可選)字符串中開始搜索searchValue的位置(默認(rèn)為0)

技術(shù)細(xì)節(jié)

返回值:如果在給定字符串內(nèi)的任何位置找到搜索字符串,則為true;否則為false
JavaScript版本:ECMAScript 6

更多實(shí)例

檢查字符串是否包含"Air",從位置2開始搜索:

var str = 'Air Pollution is introduction of chemicals to the atmosphere';
str.includes('Air', 2);   // false
測(cè)試看看?/?

 JavaScript String 對(duì)象