当前位置: 代码迷 >> 综合 >> JavaScrip 字符串替换 字符串转化为数组
  详细解决方案

JavaScrip 字符串替换 字符串转化为数组

热度:69   发布时间:2023-11-22 06:39:49.0
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><script>// 替换字符串var str1 = 'bacd' ;console.log(str1.replace('b','z'));// 将字符串转化为数组var str2 = 'a,b,c,d' ;console.log(str2.split(','));</script>
</head>
<body></body>
</html>