Skip to content

Commit 3bf4485

Browse files
authored
Update README.md
1 parent 918f196 commit 3bf4485

File tree

1 file changed

+379
-0
lines changed

1 file changed

+379
-0
lines changed

README.md

Lines changed: 379 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,382 @@
11
# Coding Bootcamp JavaScript (JS)
22

33
Our Coding bootcamp javascript 2020
4+
5+
## Questions
6+
7+
**Question:** How to find max and min number in an array using reduce method ?
8+
9+
----------
10+
11+
**Question:**Try to fill in the blanks. (Without any changes)
12+
You can add some codes instead of ?????????.
13+
Answer: The output must be true.
14+
15+
const x = ?????????;
16+
console.log(x == 5 && x == 25 && x == 125); // true
17+
18+
Note: Please not search and google it.
19+
No time limit, anyone can think and try for this.
20+
21+
----------
22+
23+
Concept: Consider the two functions below. Will they both return the same thing? Why and not?
24+
function t1()
25+
{
26+
return {
27+
bar: "hello"
28+
};
29+
}
30+
function t2()
31+
{
32+
return
33+
{
34+
bar: "hello"
35+
};
36+
}
37+
Test:
38+
console.log("t1:");
39+
console.log(t1());
40+
console.log("t2:");
41+
console.log(t2());
42+
43+
----------
44+
45+
Are you familiar with data type and operators?
46+
If you think you are a js expert, think about this:
47+
48+
**Question:**What will the code below output? Explain your answer. (guess the output)
49+
console.log(0.1 + 0.2);
50+
console.log(0.1 + 0.2 == 0.3);
51+
52+
----------
53+
54+
**Question:**Write a add method which will work properly when invoked using either syntax below.
55+
console.log( add(2)(3) ); // Outputs: 5
56+
console.log( add(4)(6) ); // Outputs: 10
57+
console.log( add(6)(6) ); // Outputs: 12
58+
59+
------------
60+
61+
Okay, we go to next step:
62+
63+
**Question:**Write a add method which will work properly when invoked using either syntax below.
64+
console.log( add(0) ); // Outputs: 0
65+
console.log( add(2) ); // Outputs: 2
66+
console.log( add(6) ); // Outputs: 6
67+
console.log( add(2)(3) ); // Outputs: 5
68+
console.log( add(4)(6) ); // Outputs: 10
69+
console.log( add(6)(6) ); // Outputs: 12
70+
71+
-------
72+
73+
But we have to expert in it to be sure of them. So trying... 👍
74+
75+
What about this?
76+
var cause a different in this case or no?
77+
const myNumber = '3';
78+
(function (callback) {
79+
console.log(myNumber);
80+
var myText = 'hello';
81+
callback();
82+
})(function () {
83+
console.log(myNumber);
84+
console.log(myText);
85+
})
86+
87+
--------
88+
89+
So it will be interest at now:
90+
const myNumber = '3';
91+
(function (callback) {
92+
console.log(myNumber);
93+
myText = 'hello';
94+
callback();
95+
})(function () {
96+
console.log(myNumber);
97+
console.log(myText);
98+
})
99+
100+
Guess it.
101+
102+
----------
103+
104+
**Question:**What will the following code output and why?
105+
var b = 1;
106+
function outer(){
107+
var b = 2
108+
function inner(){
109+
b++;
110+
let b = 5;
111+
console.log(b)
112+
}
113+
inner();
114+
}
115+
outer();
116+
117+
------------
118+
119+
**Question:** What will the following code output and why?
120+
var b = 1;
121+
function outer(){
122+
var b = 2
123+
function inner(){
124+
b++;
125+
var b = 5;
126+
console.log(b)
127+
}
128+
inner();
129+
}
130+
outer();
131+
132+
----------
133+
134+
**Question:**Guess output
135+
console.log(color);
136+
const color = '#aaa';
137+
138+
----------
139+
140+
**Question:**Guess output
141+
console.log(color);
142+
var color = '#aaa';
143+
144+
----------
145+
146+
**Question:**Guess output
147+
console.log(color);
148+
let color = '#aaa';
149+
150+
----------
151+
152+
**Question:**Guess output
153+
function square(a = 4) {
154+
return a * a;
155+
}
156+
console.log( square() );
157+
158+
----------
159+
160+
161+
**Question:**Guess output
162+
var a=4;
163+
function square(a = a) {
164+
return a * a;
165+
}
166+
console.log( square() );
167+
console.log( square(2) );
168+
169+
170+
----------
171+
172+
173+
**Question:**Guess output
174+
let a=4;
175+
function square(a = a) {
176+
return a * a;
177+
}
178+
console.log( square() );
179+
console.log( square(2) );
180+
181+
----------
182+
183+
184+
**Question:**Guess output
185+
const a=4;
186+
function square(a = a) {
187+
return a * a;
188+
}
189+
console.log( square() );
190+
console.log( square(2) );
191+
192+
----------
193+
194+
Question:
195+
function test(someVal) {
196+
typeof variable; // first question
197+
if (someVal) {
198+
typeof variable; // second question
199+
let variable;
200+
}
201+
}
202+
test(true);
203+
204+
----------
205+
206+
207+
**Question:**What will the code below output to the console and why?
208+
209+
(function(){
210+
var a = b = 3;
211+
})();
212+
console.log("a defined? " + (typeof a !== 'undefined'));
213+
console.log("b defined? " + (typeof b !== 'undefined'));
214+
215+
----------
216+
217+
**Question:**What will the code below output to the console and why?
218+
219+
var myObject = {
220+
foo: "bar",
221+
func: function() {
222+
var self = this;
223+
console.log("outer func: this.foo = " + this.foo);
224+
console.log("outer func: self.foo = " + self.foo);
225+
(function() {
226+
console.log("inner func: this.foo = " + this.foo);
227+
console.log("inner func: self.foo = " + self.foo);
228+
}());
229+
}
230+
};
231+
myObject.func();
232+
233+
----------
234+
235+
**Question:**In what order will the numbers 1-4 be logged to the console when the code below is executed? Why?
236+
Guess order and why?
237+
238+
(function() {
239+
console.log(1);
240+
setTimeout(function(){console.log(2)}, 1000);
241+
setTimeout(function(){console.log(3)}, 0);
242+
console.log(4);
243+
})();
244+
245+
----------
246+
247+
**Question:**Tell output of variables:
248+
var a = b = 3;
249+
250+
----------
251+
252+
What's Palindrome?
253+
A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam, racecar. There are also numeric palindromes, including date/time stamps using short digits 11/11/11 11:11 and long digits 02/02/2020.
254+
255+
**Question:**Write a simple function that returns a boolean indicating whether or not a string is a palindrome.
256+
257+
Test case:
258+
— level => true
259+
— levels => false
260+
261+
----------
262+
263+
**Question:**guess the d
264+
var d = {};
265+
[ 'zebra', 'horse' ].forEach(function(k) {
266+
d[k] = undefined;
267+
});
268+
console.log (d)
269+
270+
----------
271+
272+
**Question:**What will the code below output to the console and why ?
273+
274+
console.log(1 + "2" + "2");
275+
276+
----------
277+
278+
279+
**Question:**What will the code below output to the console and why ?
280+
281+
console.log(1 + +"2" + "2");
282+
283+
----------
284+
285+
**Question:**What will the code below output to the console and why ?
286+
287+
console.log(1 + -"1" + "2");
288+
289+
----------
290+
291+
**Question:**What will the code below output to the console and why ?
292+
293+
console.log(+"1" + "1" + "2");
294+
295+
----------
296+
297+
**Question:**What will the code below output to the console and why ?
298+
299+
console.log( "A" - "B" + "2");
300+
301+
----------
302+
303+
**Question:**What will the code below output to the console and why ?
304+
305+
console.log( "A" - "B" + 2);
306+
307+
----------
308+
309+
310+
**Question:**What will be the output of the following code:
311+
312+
for (var i = 0; i < 5; i++) {
313+
setTimeout(function() { console.log(i); }, i * 1000 );
314+
}
315+
316+
----------
317+
318+
319+
**Question:**What is the output out of the following code? Explain your answer.
320+
var a={},
321+
b={key:'b'},
322+
c={key:'c'};
323+
a[b]=123;
324+
a[c]=456;
325+
console.log(a[b]);
326+
327+
----------
328+
329+
**Question:**guess output
330+
console.log( + "***" );
331+
332+
----------
333+
334+
**Question:**guess output
335+
console.log(- "***" );
336+
337+
----------
338+
339+
**Question:**guess output
340+
console.log( new Number(5) == 5);
341+
console.log( new Number(5) == 5 == "5");
342+
console.log( new Number(5) == 5 == "5" == new Number(6));
343+
344+
----------
345+
346+
**Question:**guess output
347+
console.log( new Number(5) === 5);
348+
349+
----------
350+
351+
**Question:**guess output
352+
class test {
353+
#age=45;
354+
}
355+
g=new test();
356+
g.age
357+
358+
----------
359+
360+
**Question:**guess output
361+
#age=45;
362+
363+
----------
364+
365+
**Question:**JavaScript is an OOP scripting language? or no?
366+
367+
----------
368+
369+
**Question:**guess output
370+
p=new Point();
371+
console.log(p);// first answer
372+
373+
p=new Point(4);// second answer
374+
console.log(p);// third answer
375+
console.log(p.toString()); //forth answer
376+
377+
----------
378+
379+
**Question:**guess output
380+
0.1 + "0.2"
381+
"0.1" + 0.2
382+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy