-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path字符串扩展.html
58 lines (45 loc) · 1004 Bytes
/
字符串扩展.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<div id="box"></div>
<script type="text/javascript">
// let [x=y,y] = [null,5];
//
// console.log(x,y);
/*
includes(), startsWith(), endsWith()
includes():返回布尔值,表示是否找到了参数字符串。
startsWith():返回布尔值,表示参数字符串是否在源字符串的头部。
endsWith():返回布尔值,表示参数字符串是否在源字符串的尾部。
<%%>
{{}}
*/
//暂时没啥用。
// let arr = [1,2,3,4,5,6];
//
// let temp = `<ul>
// <%for(var i=0;i<arr.length;i++){%>
// <li><%=arr[i]%></li>
// <%}%>
// </ul>`;
//
//document.getElementById('box').innerHTML = temp;
/*
直接拿到字符串中的每个。
*/
const str = 'miaov';
// for(let i of str){
// //console.log(i);
//
// if(i === 'o'){
// i = i.toUpperCase()
// }
// }
console.log(str.replace(/o/,'O'));
</script>
</body>
</html>