-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
51 lines (39 loc) · 1.32 KB
/
test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src='./JavaScript/通用样式js.js'></script>
<script>
let str = '18812340303'
let str1 = '320923199901010011'
//字符串马赛克 18899992929 188****2929
String.prototype.mosaic = function () {
if (this.length === 11) {
return this.replace(this.substr(3, 4), '*'.repeat(4))
} else (this.length === 18)
return this.replace(this.substr(6, 8), '*'.repeat(8))
}
let str2 = 'ace'
let str3 = '19'
let arr = [1, 2, 3, 4, 5, 6]
console.log(str.mosaic());
console.log(str1.mosaic());
// console.log(str2.capitalize());
// console.log(str.ellipsis(4));
// console.log(str3.repairZero());
// console.log(str.split(''))
// arr.removeAt(2)
arr.splice(2, 1)
console.log(arr);
console.log(new Date().getChinaDate());
console.log(new Date().getChinaTime());
console.log(new Date().isLeapYear());
console.log(new Date().getWeekDay());
console.log(new Date().getShortText('2020-09-17 20:00:00'));
</script>
</body>
</html>