判斷開頭結尾 startsWith, endsWith基本使用#想要快速判斷一個字串的開頭是不是符合某個字串的時候,可以使用 startsWith:'abc'.startsWith('http') // false'http://'.startsWith('http') // true'https://'.startsWith('http') // true'http'.startsWith('http') // trueCopy想要快速判斷一個字串的結尾是不是符合某個字串的時候,可以使用 endsWith:'abc.com'.endsWith('.tw') // false'huli.tw'.endsWith('.tw') // true'a.b.c.t.tw'.endsWith('.tw') // true'.tw'.endsWith('.tw') // trueCopy