Skip to content

Commit e3e2224

Browse files
committed
测试静态属性静态方法
1 parent 8266e46 commit e3e2224

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

动态规划算法/index.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,70 @@
1212
<!-- <p>动态规划(Dynamic Programming,DP)是一种将复杂问题分解成更小的子问题来解决的优化技术</p> -->
1313
<!-- <script src="./最少硬币找零问题.js"></script> -->
1414
<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+
1579
// async function fun1() {
1680
// console.log('fn1')
1781
// let data = await fun2()

0 commit comments

Comments
 (0)