0% found this document useful (0 votes)
56 views

Class Notes HTML CSS Chapter3

This document discusses using variables to store and display different types of numbers in JavaScript. It provides 4 examples: 1) declaring a variable to store and display the author's age, 2) tracking the number of visits to a webpage, 3) declaring a variable for the author's birth year and displaying it in a message, and 4) declaring variables to store a visitor's name, product title, and quantity of products ordered and displaying it in a message. The goal is to demonstrate how to declare, initialize, and output the value of different numeric variables in JavaScript.

Uploaded by

Syed Shoaib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Class Notes HTML CSS Chapter3

This document discusses using variables to store and display different types of numbers in JavaScript. It provides 4 examples: 1) declaring a variable to store and display the author's age, 2) tracking the number of visits to a webpage, 3) declaring a variable for the author's birth year and displaying it in a message, and 4) declaring variables to store a visitor's name, product title, and quantity of products ordered and displaying it in a message. The goal is to demonstrate how to declare, initialize, and output the value of different numeric variables in JavaScript.

Uploaded by

Syed Shoaib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

VARIABLES FOR NUMBERS

Assignment # 3
JAVASCRIPT
VARIABLES FOR NUMBERS | JAVASCRIPT

1. Declare a variable called age & assign to it your age. Show


your age in an alert box.

2. Declare & initialize a variable to keep track of how many


times a visitor has visited a web page. Show his/her
number of visits on your web page. For example: “You
have visited this site N times”.

3. Declare a variable called birthYear & assign to it your


birth year. Show the following message in your browser:

Page 1 of 3
VARIABLES FOR NUMBERS | JAVASCRIPT

4. A visitor visits an online clothing store


www.xyzClothing.com . Write a script to store in variables
the following information:
a. Visitor’s name
b. Product title
c. Quantity i.e. how many products a visitor wants to
order
Show the following message in your browser: “John
Doe ordered 5 T-shirt(s) on XYZ Clothing store”.

Page 2 of 3
VARIABLES FOR NUMBERS | JAVASCRIPT

-- END --

Page 3 of 3

You might also like