2023 Secret Codes
// 2023 Secret Codes
// AKA: The year of the code-gnome
// Gnomes are like programmers
// They are short, they are stout
// They are always coding in their coats
var gnomes = [
"Gnome1",
"Gnome2",
"Gnome3"
];
for (var i = 0; i < gnomes.length; i++) {
console.log(gnomes[i]);
}
// Gnome2's Secret Code
// 1. Create a function that takes two numbers as input
// 2. Print out the sum of the two numbers
function add(num1, num2) {
return num1 + num2;
}
console.log(add(5, 7));
// Gnome3's Secret Code
// 1. Create an array of colors
// 2. Print out the colors in reverse order
var colors = ["red", "green", "blue"];
console.log(colors.reverse());
And here's a bonus code snippet, just for you:
// Gnome1's Secret Code
// 1. Create an object with a key of 'name' and a value of 'Gnome1'
// 2. Print out the value of the 'name' key
var gnomie = {
"name": "Gnome1"
};
console.log(gnomie.name);