let x
=>
.map()
<div>
color: teal
______
______
Theebug
Theebug — Learn to Code by Doing
Light
Start Learning
Explorer
···
▼
THEEBUG
index.tsx
learn.md
docs.md
about.md
faq.md
leaderboard.md
privacy.md
learn.md
THEEBUG
›
learn.md
JavaScript
Variables, functions, arrays, and conditionals — the fundamentals of JS.
Start Course
Beginner
3 levels
01 — lesson1.js
easy
Variables
1
// Variables store data values
2
let message = [ ___ ];
3
let count = [ ___ ];
4
5
console.log(message, count);
Assign values to the variables so the program outputs "Hello World 42"
Play
02 — lesson2.js
easy
Functions
1
function add(a, b) {
2
return [ ___ ];
3
}
4
5
let result = add(3, 7);
Complete the "add" function so it returns the sum of a and b (should out…
Play
03 — lesson3.js
easy
Array Length
1
const fruits = ["apple", "banana", "cherry"];
2
3
for (let i = 0; i < fruits.[ ___ ]; i++) {
4
console.log(fruits[i]);
5
}
Use the correct array property to loop through all fruits and log each o…
Play
Intermediate
5 levels
04 — lesson4.js
medium
Array Methods
1
const nums = [1, 2, 3, 4, 5];
2
const doubled = nums.[ ___ ](n => n * 2);
3
4
console.log(doubled);
5
// [2, 4, 6, 8, 10]
Use the right array method to create a new array with each number double…
Play
05 — lesson5.js
medium
Conditionals
1
function checkAge(age) {
2
if (age [ ___ ] 18) {
3
return "You can vote!";
4
}
5
return "Too young";
Add the right comparison operator to check if age is 18 OR older
Play
08 — lesson8.js
medium
Objects
1
const user = { name: "Ada", age: 30 };
2
console.log(user.[ ___ ]);
Access the user's name property using dot notation
Play
09 — lesson9.js
medium
Loops
1
const colors = ["red", "green", "blue"];
2
for (const color [ ___ ] colors) {
3
console.log(color);
4
}
Complete the for...of loop to print each color
Play
010 — lesson10.js
medium
Template Literals
1
const name = "Ada";
2
const age = 30;
3
const bio = `${name} is [ ___ ] years old`;
4
console.log(bio);
Complete the template literal to interpolate the age variable
Play
Advanced
3 levels
06 — lesson6.js
hard
Closures
1
function makeCounter() {
2
let count = 0;
3
return function () {
4
count [ ___ ] 1;
5
return count;
Complete the closure so each call to counter() increases and returns the…
Play
07 — lesson7.js
hard
Destructuring in Callbacks
1
const students = [
2
{ name: "Ana", score: 80 },
3
{ name: "Bo", score: 90 },
4
];
5
Destructure each student object in the reduce callback to pull out just …
Play
011 — lesson11.js
hard
Error Handling
1
function parseNumber(str) {
2
try {
3
return JSON.parse(str);
4
[ ___ ] (err) {
5
return null;
Complete the try/catch so a parsing failure returns null instead of cras…
Play
main
UTF-8
Markdown