Challenge: Access Array Elements
Task
- Create an array called
stars
with the following star names:- "Sirius";
- "Alpha Centauri";
- "Betelgeuse";
- "Polaris".
- Log individual star names using different indices (0, 1, 2, and 3) using
console.log
const stars = ___; console.log("First element:", ___); // Output: Sirius console.log("Second element:", ___); // Output: Alpha Centauri console.log("Third element:", ___); // Output: Betelgeuse console.log("Forth element:", ___); // Output: Polaris
Expected output:
pythonFirst element: SiriusSecond element: Alpha CentauriThird element: BetelgeuseForth element: Polaris
Obrigado pelo seu feedback!