Hello! My code wasn’t working (again) and I couldn’t figure out why. I looked at the solution again and realised I was placing my constant declaration inside of the function instead of outside. When and why do we place it inside the code and when and why do we place it outside? Also, how long should I be thinking about my code by myself before looking at the solution on Codecademy? I don’t know if I’m giving up to soon and losing valuable thinking time.
const greetAliens = arr => {
for (let i = 0; i < arr.length; i++) {
console.log("Oh powerful " + arr[i] + ", we humans offer our unconditional surrender!");
}
}
const aliens = ["Blorgous", "Glamyx", "Wegord", "SpaceKing"];
greetAliens(aliens)