Skip to content

Commit 5bb3b61

Browse files
committed
调整
1 parent 84f35a4 commit 5bb3b61

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

number.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,28 @@ console.log(d)
3737
//链式操作+给Number/Object对象添加方法
3838

3939

40-
Number.prototype.add = function (n){
41-
return this.valueOf() + n
40+
Number.prototype.add = function (n) {
41+
return this.valueOf() + n
4242
}
4343

44-
Number.prototype.minus = function (n){
45-
return this.valueOf() - n
44+
Number.prototype.minus = function (n) {
45+
return this.valueOf() - n
4646
}
4747

4848
console.log((5).add(3).minus(2))
4949

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

Comments
 (0)