方法用于组合两个或多个字符串并
结果,整个字符串变成大写。 然后,转换后的字符串存储在变量 uppercase 中,控制台中的输出为“HELLO, WORLD!” toLowerCase() 方法 该方法将字符串中的所有字符转换为小写 这是一个例子: let text = "Hello, World!"; let lowercase = text.toLowerCase(); console.log(lowercase); 这段代码运行后,“lowercase”变量将包含值“hello, world!”这将是控制台中的输出。concat() 方法 “concat()”创建一个包含合并文本的新字符串。 它不会修改原始字符串。相反,它返回一个由原始字符串组合(称为串联)产生的新字符串。 它的工作原理如下: const string1 = "Hello, "; const string2 = "world!"; const concatenatedString = string1.concat(s 手机号码清单 tring2); console.log(concatenatedString); 在此示例中,我们有两个字符串“string1”和“string2”。
https://www.marketinglist.club/wp-content/uploads/2024/05/%E6%89%8B%E6%9C%BA%E5%8F%B7%E7%A0%81%E6%B8%85%E5%8D%95-300x300.png
我们想要连接它。 我们对“string1”使用“concat()”方法,并提供“string2”作为参数(括号内的输入值)。该方法组合两个字符串并创建一个新字符串,存储在“concatenatedString”变量中。 然后程序将最终结果输出到您的控制台。在这种情况下,那就是“你好,世界!” match() 方法 “match()”方法用于在字符串中搜索指定模式,并将匹配结果作为数组(保存值集合的数据结构,如匹配的子字符串或模式)返回。
頁:
[1]