0% found this document useful (0 votes)
16 views4 pages

Grade - Level - 8 - Classwork - 1 - With Asnwer

8

Uploaded by

julianto.liem55
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)
16 views4 pages

Grade - Level - 8 - Classwork - 1 - With Asnwer

8

Uploaded by

julianto.liem55
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

Classwork

Javascript in HTML Document

NAME:

Julianto 8n

1. What is JavaScript?
Write a short definition of JavaScript based on the information provided.

Javascript is a scripting languange with a very simple sytax

2. Why is JavaScript important?


List three reasons why JavaScript is essential for web development.

1. it helps to add interactive elements to HTML pages.


2. it is a scripting languange which is also a lightweight programming language.
3.Everyone can use Javascript without purchasing a license.

3. Basic Syntax
Write the JavaScript code that creates a pop-up alert saying "Hello, World!" using HTML tags.

<html>
<body>
<script language="JavaScript"> document.write("Welcome to JavaScript");
</script>
</body>
</html>
4. External JavaScript Files
Why is it beneficial to use external JavaScript files? List two reasons.

1.if you want to run the same JavaScript on several pages without having to write the
same script on every page.
2. it is a simplified version of html

5. What is the Object Model?


Explain what it means that JavaScript is an object-based language.

This means that you think about your JavaScript program in terms of the objects you
want to work with.

6. Key Objects
Identify and describe two key objects in JavaScript.

Object 1:
document.write()
Description 1:
The document.write() method is used for displaying the text on the browser window.

Object 2:

window.alert()
Description 2:
window.alert() is a method of the window object that is used to display a short
message to the user in separate small window.

7. Using document.write
What is `document.write` used for? Write an example of how to use it.

It is used for displaying the text on the browser window.


Example:
<html><body><script language="JavaScript"document.write("Welcome to JavaScript");
</body></html>

8. Rules for Writing JavaScript


List two key rules for writing JavaScript programs.

1.
JavaScript is a case sensitive language.

2.
A program can have more than one of the <script>...</script> tags.

9. What are variables?


Define what a variable is in JavaScript and give an example.

Variables are the names assigned to a memory location that can be used for storing
data.

Example:

`let name = "____________________";`


Car
10. Types of Operators
Write down one example of each type of operator mentioned.

Arithmetic Operator:

Addition +
Assignment Operator:

= assign value
Comparison Operator:

== is equal to
Logical Operator:

! not

You might also like