相关文章推荐
仗义的竹笋  ·  [Day15] 帳號登入 - iT ...·  1 年前    · 
俊逸的黄瓜  ·  ModuleNotFoundError: ...·  1 年前    · 
被表白的书签  ·  MongoDB C# 查找 ...·  1 年前    · 

concat替代函数

concat 函数是指将两个或多个字符串连接在一起,形成一个新的字符串。如果要替代这个函数,可以使用加号(+)来代替它。例如:

let str1 = "hello";
let str2 = "world";
// 使用 concat 函数
let str3 = str1.concat(" ", str2);
console.log(str3); // "hello world"
// 使用 + 运算符
let str4 = str1 + " " + str2;
console.log(str4); // "hello world"
  •