Our JS Quiz Is Now Closed
Look for future editions coming soon.
Questions and right answers.
1. What is not the name of an ECMAScript standard implementation?
Correct answer:d) TypeScript
2. Where can't you run JavaScript?
Correct answer:d) Devices without processors
3. Which is the smallest and fastest library for JavaScript?
Correct answer:d) Vanilla JS
4. Is JavaScript object-oriented or is it a functional language?
Correct answer:d) Both object-0riented and functional (multi-paradigm)
5. Which of the results of the following won't have a number type?
Correct answer:a) 77 + '77'
6.
What is the length of the array?
[...[...
'...'
]]
Correct answer:c) 3
7.
What will be the output?
let x
,
{
x:
y=
1
} = {
x};
console
.log(
y);
Correct answer:b) 1
8.
What algorithm does the JavaScript Array.sort() function use?
Correct answer:d) Depends on the browser and the type of array
9.
It's time for chaining assignments on objects. What will be the output?
let foo
= {
n:
1
};
let bar
=
foo;
foo
.
x=
foo= {
n:
2
};
console
.log(
foo.
x);
console
.log(
foo);
console
.log(
bar);
Correct answer:a) undefined
{ n: 2 }
{ n: 1, x: { n: 2 } }
10.
One of the common questions about 'setTimeout.' What will be the output?
for
(
var i=
0
;
i<
3
;
i++) {
setTimeout
(() =>
console.log(
i));
}
Correct answer:c) 3
3
3
11.
Let's continue with setInterval + Promise. What will be the output?
(() => {
console
.log(
'START'
);
const
interval
= setInterval(() => {
console
.log(
'setInterval'
);
clearInterval(
interval
);
},
0
);
Promise
.resolve().then(() =>
console.log(
'promise'
));
console
.log(
'END'
);
})();
Correct answer:a) START
END
promise
setInterval
12.
Ok, and what we will get after running this code:
((x, func = () => x) => {
var
x
;
var
y
=
x
;
x
=
2
return
[
x
,
y
, func()];
})(
1
);
Correct answer:b) [2,1,1]
13.
And, for 'arguments,' what will we get here:
function
func1(x, y) {
arguments
[
0
] = y;
return
x;
}
function
func2(x, y) {
return
[
arguments[
1
], func1(x, y)];
}
func2(
1
,
2
);
Correct answer:c) [2,2]
14.
Now the arrow function. What will we get after running this code:
let
f1 = () => {};
f1();
let
f2 = () => {
this
.
a=
1
;
};
new
f2();
let
f3 = () =>
arguments;
f3(
'a'
)
Correct answer:c) udefined
TypeError
ReferenceError
15.
And what about this interesting syntax - what will we get as value?
function
* multiplier(value) {
const
first
=
2
* (
yield(value /
2
));
const
second
=
yield(
first
);
return
(value *
first
*
second
);
}
const multi
= multiplier(
10
);
multi
.next(
1
);
multi
.next(
10
);
multi
.next(
1
);
Correct answer:
a) 5
20
200