React 判断是否包含字符 includes Nov 13, 2023 react 对字符串是否包含特定字符的判断,使用includes来判断: const myString = "Hello [World]"; if (myString.includes("[")) { console.log("字符串包含'['"); } else { console.log("字符串不包含'['"); }