Skip to content

Commit 8e571c0

Browse files
committed
feat: 🎸 output guessing questions
1 parent b1a61b3 commit 8e571c0

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

2024 Prep/guess_the_output/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,40 @@ for (let i = 0; i < 4; i++) {
7979
}
8080

8181
// 0 1 2 3
82+
83+
const arr = [1, 2, 3, 4, 5]
84+
const arr2 = ['prathamesh', 'test', '889', 4, 5, { a: '000' }]
85+
const obj = { ...arr2 }
86+
87+
const promise = new Promise(res => res(2))
88+
89+
/*
90+
promise
91+
.then(v => {
92+
console.log(v)
93+
return v * 2
94+
})
95+
.then(v => {
96+
console.log(v)
97+
return v * 2
98+
})
99+
.finally(v => {
100+
console.log({ msg: 'finally', v }) // * finally value will be always undefined, even if promise is fulfilled or rejected
101+
return 0
102+
})
103+
.then(v => {
104+
console.log(v)
105+
})
106+
*/
107+
108+
// for (let i in arr3) {
109+
// console.log(i)
110+
// }
111+
112+
// for (let i of arr3) {
113+
// console.log(i)
114+
// }
115+
// const arr3 = [3, 4, 5, 6]
116+
117+
// arr3.foo = 'Hi'
118+
// console.log(arr3)

2024 Prep/guess_the_output/index2.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var length = 10
2+
3+
function fn() {
4+
console.log(this.length)
5+
}
6+
7+
fn()
8+
9+
var obj2 = {
10+
length: 5,
11+
method: function (fn) {
12+
fn()
13+
arguments[0]()
14+
},
15+
}
16+
17+
obj2.method(fn, 1)

0 commit comments

Comments
 (0)