JavaScript Essentials 1
JavaScript Essentials 1
generate and load a minimal blank HTML page into the current tab.
clear all inputs on the current page.
generate a page with information about the browser's status.
open a tab with information about your browser.
Error! Filename not specified.
Completed Question 2
Question 2
Multiple choice question
1
2
3
4
5
6
let id = "100";
{
let id = 200;
id = id + 1;
console.log(id);
}
201
101
1001
200
Error! Filename not specified.
Completed Question 3
Question 3
Multiple choice question
Array, Object
Array, Object, String
Object, String
Boolean, Number, Bigint
Error! Filename not specified.
Completed Question 4
Question 4
Multiple choice question
let x = 0.003;
let x = 3000;
let x = 0.0003;
let x = 0.333;
Error! Filename not specified.
Completed Question 5
Question 5
Multiple choice question
1
"I do not like travelling by plane"
Question 6
Multiple choice question
1
2
3
let movie = {
title: "Life",
year: 1999
Question 7
Multiple choice question
You declare the following array of animals: let animals = ["canary", "dog", "cat"];. Then,
you call the method animals.push("hamster");. What will the animals array look like after
calling the method?
Question 8
Multiple choice question
Question 9
Multiple choice question
1
let winter = ["December", "January", "February"]; let index =
winter.indexOf("February");
2
1
"February"
3
Error! Filename not specified.
Completed Question 10
Question 10
Multiple choice question
In the daysOfWeek variable, you place an array with the names of the days of the week.
Which method will you call to reverse the order of the array elements.
daysOfWeek.reverse();
daysOfWeek = reverse(daysOfWeek);
daysOfWeek.invert();
daysOfWeek.order(-1);
Error! Filename not specified.
Completed Question 11
Question 11
Multiple choice question
1
2
3
let msg1 = 'hello';
let msg2 = msg1.slice(-1);
console.log(msg2 ? msg2 : msg2 + msg1);
o
h
ohello
hello
Error! Filename not specified.
Completed Question 12
Question 12
Multiple choice question
1
let test = prompt("Run", "code");
What value will the test variable have if, after running the code, we immediately press
the OK button on the newly created dialog?
code
Run
OK
true
Error! Filename not specified.
Completed Question 13
Question 13
Multiple choice question
1
2
3
4
let x = false || true;
let y = "true" && "false";
let z = false && true;
console.log(`${x} ${y} ${z}`);
Question 14
Multiple choice question
1
2
3
4
let a = true && 20;
let b = 0 || 20
let c = 0 && 20;
console.log(`${a} ${b} ${c}`);
20 20 0
110
true 20 0
true true false
Error! Filename not specified.
Completed Question 15
Question 15
Multiple choice question
1
2
3
4
5
6
let a = 20 + "10";
let b = 20 + +"10";
let c = 20 + -"10" + "10";
let d = "10" - "10" + "100";
let e = "A" - "B" + 0xA;
console.log(`${a}, ${b}, ${c}, ${d}, ${e}`);
Question 16
Multiple choice question
Which of the following loop instructions checks the loop continuation condition only after
the iteration has been completed?
do ... while
while
for ... in
for
Error! Filename not specified.
Completed Question 17
Question 17
Multiple choice question
What could the definition of the corresponding arrow function look like?
Question 18
Multiple choice question
The temp array contains air temperature data measured over a period of time. You want
to display the minimal temperature using the following code:
1
2
temp.forEach(e => min = min > e ? e : min);
console.log(min);
Question 19
Multiple choice question
1
2
3
4
let x = [10, 20, 30, 40];
let y = [50, 60];
x.reverse().push(y);
console.log(x.length);
5
6
4
2
Error! Filename not specified.
Completed Question 20
Question 20
Multiple choice question
1
2
3
for(let a=1; a<10; a+=2) {
console.log(a);
};
let counter = 0;
while (counter++ < 10) console.log(counter++);
let counter = 1;
while (counter++ < 10) console.log(counter++);
let counter = 0;
while (counter < 10) console.log(counter++);
let counter = 0;
while (counter < 9) console.log(counter++);
Error! Filename not specified.
Completed Question 21
Question 21
Multiple choice question
1
2
let colors = ['red', 'green', 'blue'];
for (let c of colors) console.log(c);
red
green
blue
['red', 'green', 'blue']
0
1
2
3
Error! Filename not specified.
Completed Question 22
Question 22
Multiple choice question
1
2
let route = {distance: 131, elevation: 1.4};
for (let k in route) console.log(k);
distance
elevation
131
1.4
distance
2
Error! Filename not specified.
Completed Question 23
Question 23
Multiple choice question
1
2
3
4
let a = (n) => {
return n > 2 ? n * a(n - 1) : 2
}
console.log(a(6));
720
120
6
4
Error! Filename not specified.
Completed Question 24
Question 24
Multiple choice question
1
2
let x = mult(2)(10);
console.log(x); // -> 20
What should the mult function declaration look like if the execution of this code results in
a value of 20 in the console?
Question 25
Multiple choice question
After declaring the counter variable, we want to add a short comment with information
about what the variable is used for. To do this, we modify the line with the declaration to
the form:
Question 26
Multiple choice question
1
2
x = [40, 10, 30, 20, 50];
x.sort(cmp);
How should the function cmp be declared if, after the code execution, the elements of
the array x are sorted in ascending order?
Question 27
Multiple choice question
1
2
3
4
5
let counter = 2;
let interval = setInterval(() => {
console.log(counter);
// Insert missing line here.
}, 1000);
What should the missing line look like if the execution of this code results in the console
displaying the values 2, 1, and 0 in sequence?
Question 28
Multiple choice question
1
2
3
4
function execute(todo, a, b) {
return todo(a, b);
}
console.log(execute(power, 3, 2));
Before declaring the function, we should add one more line of code. Which one, if the
execution of the completed code will result in the console displaying the value 9?
Question 29
Multiple choice question
1
2
3
4
5
6
7
8
const a = "hello";
console.log(a.toUpperCase());
}
} catch (error) {
console.log(a)
} finally {
console.log(a);
}
The following words will appear in the console on subsequent lines: HELLO and hello.
The following words will appear in the console on subsequent lines: hello and hello.
The following word will appear in the console: HELLO.
The following words will appear in the console on subsequent
lines: HELLO, hello, and hello.
Error! Filename not specified.
Completed Question 30
Question 30
Multiple choice question
pause the program with the ability to continue, as long as the execution environment
supports "debugging functionality".
stop the program without the ability to continue, as long as the execution environment
supports "debugging functionality".
put the interpreter into report mode, which will cause the console to print out all
sequentially executed commands.
cause the console to display the completion status of the statement preceding the
debugger.
Error! Filename not specified.
You've submitted your answers!
Reset