|
12 | 12 | <!-- <p>动态规划(Dynamic Programming,DP)是一种将复杂问题分解成更小的子问题来解决的优化技术</p> -->
|
13 | 13 | <!-- <script src="./最少硬币找零问题.js"></script> -->
|
14 | 14 | <script>
|
| 15 | + |
| 16 | + |
| 17 | + // let singLetn = function (name) { |
| 18 | + // this.name = name; |
| 19 | + // this.instance = null |
| 20 | + // } |
| 21 | + // // singLetn.instance = 9 不会执行进入 注释掉 就可以 |
| 22 | + |
| 23 | + // singLetn.getInstance = function (name) { |
| 24 | + // if (!this.instance) { |
| 25 | + // console.log('进入') |
| 26 | + // this.instance = new singLetn(name) |
| 27 | + // } |
| 28 | + // // 这里的this 是singLetn构造函数 不是实例对象 |
| 29 | + // return this.instance |
| 30 | + // } |
| 31 | + |
| 32 | + // let a = singLetn.getInstance('7') |
| 33 | + // let b = singLetn.getInstance('8') |
| 34 | + // console.log(singLetn.instance) |
| 35 | + // console.log(a == b) |
| 36 | + |
| 37 | + // function test() { |
| 38 | + // // this.是往实例属性上加 |
| 39 | + // console.log(this) |
| 40 | + // let cc = 'pp' |
| 41 | + // this.time = '987' |
| 42 | + // console.log(cc) |
| 43 | + // } |
| 44 | + // let ppppp = new test() |
| 45 | + |
| 46 | + // let str = 'heshihao' |
| 47 | + // console.log(str.charAt(1)) |
| 48 | + // console.log(str[1])//没有区别 都可以获得到e |
| 49 | + |
| 50 | + // class Person { |
| 51 | + // constructor() { |
| 52 | + // this.sex = '女' |
| 53 | + // } |
| 54 | + // static getName() { |
| 55 | + // console.log(this.sex) |
| 56 | + // } |
| 57 | + // static sex = '男' |
| 58 | + // } |
| 59 | + |
| 60 | + |
| 61 | + // let p9 = new Person() |
| 62 | + // Person.getName() |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + // function foooo() { |
| 67 | + // let instance = 'pppp' |
| 68 | + // this.instance = null |
| 69 | + // } |
| 70 | + // foooo.instance = 'name' |
| 71 | + |
| 72 | + // foooo.getName = function () { |
| 73 | + // console.log(this.instance) |
| 74 | + // } |
| 75 | + |
| 76 | + // let f8 = new foooo() |
| 77 | + // foooo.getName() |
| 78 | + |
15 | 79 | // async function fun1() {
|
16 | 80 | // console.log('fn1')
|
17 | 81 | // let data = await fun2()
|
|
0 commit comments