forked from RubyLouvre/anu
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index2.html
executable file
·79 lines (73 loc) · 2.36 KB
/
index2.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<script type="text/javascript" src="./dist/React.js"></script>
<!-- <script type='text/javascript' src="./lib/ReactTestUtils.js"></script>
<script type='text/javascript' src="./dist/ReactDOMServer.js"></script>-->
<script
type="text/javascript"
src="./test/react.development.js"
></script>
<script
type="text/javascript"
src="./test/react-dom.development.js"
></script>
<script type="text/javascript" src="./lib/babel.js"></script>
</head>
<body>
<div id="root" class="root"></div>
<script>
function maxSubArray(nums) {
var sum = nums[0];
var max = nums[0];
for(var i = 1;i < nums.length; i++) {
if(max >0) {
max += nums[i];
}else{
max = nums[i]
}
if(sum < max){
sum = max;
}
}
return sum;
}
console.log(maxSubArray([-2,1,-3,4,-1,2,1,-5,4]))
//javascript的进化 https://www.html.cn/archives/9925 https://www.cnblogs.com/crazycode2/p/9430155.html
// 0. JSON官方化
// 1. 异步的进化 callback, event, Promise, generators, async/await
// 2. 作用域类型的增加 let const
// 3. 基础类型的增加 symbol BigInt
// 4. 类的标准化 class
// 5. 模块化的标准化
// 6. 原型方法的极大丰富
// 7. 反射 set, get(针对单个属性), Object.defineProperty(针对单个属性,对低端浏览器友好),
// Object.seal/freeze/preventExtensions(针对多个属性),
// Reflect(Object.defineProperty的改良),
// Proxy(支持更多操作),
// 8. 更甜的语法糖:
// 对象简写
// **(冥运算),
// ...(浅拷贝),
// =>(箭头函数),
// for of(遍历可迭代对象的所有值, for in是遍历对象的键或索引)
// 1_222_333 (数字格式化), https://www.jianshu.com/p/77f8130fd278
// `hello ${world}` (字符串模板化与天然多行支持)
var obj = {
a: 1,
b: true,
c: {
d: 1
}
}
var entries = Object.entries(obj);
//将数组再转换为对象fromEntries
var fromEntries = Object.fromEntries(entries);
console.log(fromEntries.c === obj.c)
var obj2 = {...obj}
console.log(obj2.c === obj.c)
</script>
</body>
</html>