From the course: JavaScript: Scope

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Define global variable

Challenge: Define global variable - JavaScript Tutorial

From the course: JavaScript: Scope

Start my 1-month free trial

Challenge: Define global variable

(light cymbals) - [Instructor] There's no better way to learn than to challenge yourself to do what we just learned, and we'll do just that. So here's the challenge. I want you to declare an array of warriors that is globally scoped and then a global function that will log in the const of this list of warriors. If you're familiar with the const and let variables, feel free to use them to declare your variables, and if not, you can use var too. It's not really that important for this exercise, as long as you have all your declarations globally scoped. Good luck!

Contents