• Master Hun

JavaScript Worksheet 000 - Variables

PythonFuMasters.com JavaScript worksheet 000


Definition: variable, variables

Variables are like boxes (or containers). Each variable (or box or container) must have a unique name (or label). Like boxes, variables are used to hold things. Variables are like boxes coders use to hold information (or data or values).

The three basic variable types are number (integer or floating point) variables, strings (words, sentences, letters, numbers, special characters), and Boolean (true or false) variables.


Exercise 0

Using the var keyword, declare (or create) an integer variable, a string variable, and a Boolean variable. Assign a value to each variable.

1. __________________________________________________

2. __________________________________________________

3. __________________________________________________


Execise 1

In four lines of JS code, create (or declare) a string variable with the value "Hello, world!". Using the alert() function, display the string variable. Then assign it a different string value (your choice). Again using the alert() function, display the string variable.

1. __________________________________________________

2. __________________________________________________

3. __________________________________________________

4. __________________________________________________


What is hardcoding? ____________________________________

____________________________________________________

Why is hardcoding deprecated? ____________________________

____________________________________________________

If a coder declares the same variable twice or more, what do we call this?

____________________________________________________



JavaScript Worksheet 000 - Variables

(646) 902 - 5486

©2019 by PythonFuMasters. Proudly created with Wix.com