We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84f35a4 commit 5bb3b61Copy full SHA for 5bb3b61
number.js
@@ -37,13 +37,28 @@ console.log(d)
37
//链式操作+给Number/Object对象添加方法
38
39
40
-Number.prototype.add = function (n){
41
- return this.valueOf() + n
+Number.prototype.add = function (n) {
+ return this.valueOf() + n
42
}
43
44
-Number.prototype.minus = function (n){
45
- return this.valueOf() - n
+Number.prototype.minus = function (n) {
+ return this.valueOf() - n
46
47
48
console.log((5).add(3).minus(2))
49
50
+var obj = { 1: 222, 2: 333, 5: 888 }
51
+
52
+function hander(obj){
53
+ let arr = []
54
+ for(let i = 1;i <= 12;i++){
55
+ if(obj[i]){
56
+ arr.push(obj[i])
57
+ }else{
58
+ arr.push(null)
59
+ }
60
61
+ return arr
62
+}
63
64
+console.log(hander(obj))
0 commit comments