Grade - Level - 8 - Classwork - 1 - With Asnwer
Grade - Level - 8 - Classwork - 1 - With Asnwer
NAME:
Julianto 8n
1. What is JavaScript?
Write a short definition of JavaScript based on the information provided.
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
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.
1.
JavaScript is a case sensitive language.
2.
A program can have more than one of the <script>...</script> tags.
Variables are the names assigned to a memory location that can be used for storing
data.
Example:
Arithmetic Operator:
Addition +
Assignment Operator:
= assign value
Comparison Operator:
== is equal to
Logical Operator:
! not