| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <!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>
- <!-- 正则表达式
- const 名称 = /需要校验的规则/
- 修饰符:
- g 匹配全局
- i 不区分大小写
- -->
- <script>
- const reg = /aa/gi;
- const str = 'AA,四大名著有aa,我也爱看Aa'
- console.log(reg.test('xxxxxx'));
- console.log(reg.exec(str));
- console.log(str.match(reg))
- const res = str.replace(reg, '红楼梦');
- console.log(res);
- /**
- * js数据类型
- * 基本:string boolean number undefined null symbol bigInt
- * 引用:Object(对象 数组 函数)
- * 怎么去判断数据类型
- * typeof
- * instanceof
- * Object.prototype.toString.call()
- * constructor
- * 盒模型
- * 数组的方法 那些会改变原数组 那些不会改变原数组
- * for in / for of
- * map/forEach
- * 为什么data是函数
- *
- * this指向
- * call bind apply
- * Promise
- * async await
- * eventLoop
- */
- let arr = [1, 2, 3, 4, 5];
- let obj = {
- aa: 11,
- bb: 22
- }
- let m = obj;
- m.aa = 33;
- console.log(m, 'm')
- console.log(obj, 'obj')
- // for (let key of Object.entries(obj)) {
- // console.log(key, 'key');
- // }
- // arr.forEach(item => {
- // console.log(item)
- // return c = item + 1
- // });
- // console.log(arr)
- </script>
- </body>
- </html>
|