-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw3.js
38 lines (34 loc) · 831 Bytes
/
hw3.js
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
function max(iterable, key) {
var maximum = Number.NEGATIVE_INFINITY;
for (var i in iterable) {
var i = key(i);
if (i >= maximum) {
maximum = i;
}
}
return maximum;
}
const reverser = (x) => -x;
function changer(object, key, value) {
var prev = object[key];
if (Array.isArray(prev)) {
prev.push(value);
} else if (typeof prev == 'object' && prev != null) {
object = JSON.stringify({ key: key, value: value });
} else {
object[key] = value;
}
return null;
}
async function promise_me(truthy) {
const a = new Promise((resolve, reject) => {
console.log(1)
resolve(truthy)
})
console.log(2)
console.log(3)
console.log(4)
const five = console.log(five)
console.log(five)
return five
}