VARIABLES
FOR
STRINGS
Assignment
#
2
JAVASCRIPT
MODULE
A
-‐
Mobile
&
Cloud
Computing
VARIABLES
FOR
STRINGS
|
JAVASCRIPT
1. Declare a variable called username.
2. Declare a variable called myName & assign to it a string
that represents your Full Name.
3. Write a script to
a. declare a JS variable, titled message
b. assign “Hello World” to the variable message
c. display the message in alert box
4. Write a script to save student’s bio data in JS variables
and show the data in alert boxes. Example:
Page
1
of
4
VARIABLES
FOR
STRINGS
|
JAVASCRIPT
5. Write a script to display the following alert using one JS
variable:
6. Fortune Teller: Why pay a fortuneteller when you can
just program your fortune yourself?
Store the following into variables: number of children,
partner’s name, geographic location, and job title.
Page
2
of
4
VARIABLES
FOR
STRINGS
|
JAVASCRIPT
Output your fortune like:
7. Declare a variable called email & assign to it a string that
represents your Email Address (e.g.
[email protected]). Show
the below mentioned message in an alert box. (Hint: use
string concatenation)
8. Declare a variable called book & give it the value “A
smarter way to learn JavaScript”. Display the following
message in an alert box:
Page
3
of
4
VARIABLES
FOR
STRINGS
|
JAVASCRIPT
9. Use the variables, declared in exercise 4 & show the details
giving meaning to data. Like “My name is Ali Khan”, “I am
17 years old”, “I study in SSUET”, “I take Mobile & Cloud
Computing, Module A classes”
10. Write a script to display this in browser through JS
-- END --
Page
4
of
4