Home / Exercises / Variables

Variables

In src/index.js complete:

Exercise 1

a. Create a variable myName and assign it a value of your name.

b. Display your name by passing myName to the alert() function.

Open index.html. Your name should appear in the alert box.

HINT: If your name is made up of alphabetical characters remember to wrap your name in double quotations. This is called a string.

PRO TIP: In your browser, press CTRL + SHIFT + I to open dev tools. Click on the network tab in opened dev tools to see all your console logs, errors and more information.


Expected Results

Exercise 1

a.

var myName = 'Go4Tech';

b.

var myName = 'Go4Tech';
alert(myName);

Previous: Exercises
Next: Functions