All courses
0/14 steps
Lesson 1 · Arrays & warning lists
Step 1/ 2
Moderation bots keep lists — warned users, banned words, audit logs. In JavaScript a list is called an Array.
Create a const warnings = [] (empty array). Use warnings.push("User#1234 - Spam") to add a warning, then console.log(warnings.length) to see how many there are.
Example
const fruits = [];
fruits.push("apple");
fruits.push("banana");
console.log(fruits.length); // 2main.js
Console
Press Check to run your code…
Lesson 1 · Arrays & warning lists
Step 1/ 2
Moderation bots keep lists — warned users, banned words, audit logs. In JavaScript a list is called an Array.
Create a const warnings = [] (empty array). Use warnings.push("User#1234 - Spam") to add a warning, then console.log(warnings.length) to see how many there are.
Example
const fruits = [];
fruits.push("apple");
fruits.push("banana");
console.log(fruits.length); // 2
