Home Quiz Resolution

2025 Resolution

Conquer JavaScript

booleans operators variables functions arrays loops 🚀

Calling all cosmic coders
study with me and let's conquer this mission! 🪐

Question 1


What is the output? A, B, C or D?

console.log ('I want to go to space in a rocket' [0]);
🪐
A: "I want to go to space in a rocket"
B: "I"
C: Undefined
D: " "

Question 1
Answer: B
The bracket notation is looking for a specific zero [0] character in this string. The first character in the string is always calculated as the zero so the result is "I".

Question 2


What is the output? A, B, C or D?

const sum = [ 1 + 5, 1 * 2, 1 / 2];
console.log (sum);
🪐
A: ["1 + 5", 1 * 2, 1 / 2]
B: [ "15", "2", "0.5"]
C: [1, 1, 1]
D: [6, 2, 0.5]

Question 2
Answer: D
Arrays can hold any value i.e numbers, strings, dates, objects etc.
Here 1 + 5 returns 6, 1 * 2 returns 2 and 1 / 2 returns 0.5.

Question 3


Why will this Conditional (Ternary) Operator return an exexpected string error?
🪐

const examTarget = 80
const examScore = 70 "Excellent work" : "Keep studying!"
console.log (examScore)

Question 1
Answer: It is missing the ?
A ternary operator always gives the true expression and the false expression using the symbols ? and : so the true expression was missing the ?
const examScore = 70 ? "Excellent work" : "Keep studying!"

Question 4


What is the output? A, B, C or D?

Let num = 1;
const list = ['🎇', '🚀', '👩🏿‍🚀', '🌕'];
console.log (list [(num += 1)]);

A: 🎇
B: 🚀
C: 👩🏿‍🚀
D: 🌕

Question 2
Answer: 👩🏿‍🚀

The += operator increases 'num' by 1, and 'num' has the initial value of 1. 1+1 is 2 so the second item on the array is 👩🏿‍🚀 because and array starts at zero.