

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
Back
ctrl+,
Next
ctrl+.
JavaScript's arrays are similar to Python's lists.
One important thing about JavaScript arrays are that items in an array are not required to be of the same type... Remember, JavaScript is about as loosy-goosy as programming languages get...
const numbers = [1, 2, 3, 4, 5];
const strings = ["banana", "apple", "pear"];
const miscellaneous = [true, 7, "adamantium"];
You can index into an array using square brackets []:
const strings = ["banana", "apple", "pear"];
console.log(strings[0]);
// Prints: 'banana'
And you can .push() new items onto the end of an array:
const drinks = [];
drinks.push("lemonade");
console.log(drinks);
// Prints: ['lemonade']
drinks.push("root beer");
console.log(drinks);
// Prints: ['lemonade', 'root beer']
Textio keeps a record of messages that have been successfully sent. Your task is to manage this message history using an array.
Focus Editor
Alt+Shift+]
Become a member to Submit
Become a member to Run
Become a member to view solution