0% found this document useful (0 votes)
44 views6 pages

Q3 Computer 10 Week 1

The document provides a lesson on performing mensuration and calculation. It discusses selecting appropriate measuring tools and instruments according to job requirements. It also discusses using alternative measuring tools without sacrificing cost and quality of work.

Uploaded by

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

Q3 Computer 10 Week 1

The document provides a lesson on performing mensuration and calculation. It discusses selecting appropriate measuring tools and instruments according to job requirements. It also discusses using alternative measuring tools without sacrificing cost and quality of work.

Uploaded by

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

Computer 10

3RD Quarter

Lesson 5:
PERFORMING MENSURATION AND CALCULATION

Learning Competencies
 Select measuring tools appropriate to the object to
be measured based on job requirements
Quarter 3  Select appropriate measuring instruments according
WEEK 1 to job requirements
 Use alternative measuring tools without sacrificing
cost and quality of work

Introduction to JavaScript Programming

Introduction

JavaScript is among the most powerful and flexible programming


languages of the web. It powers the dynamic behavior on most websites,
including this one.

JavaScript is a lightweight, cross-platform and interpreted scripting


language. It is well-known for the development of web pages, many non-
browser environments also use it.

Learning Objectives/Outcomes:

At the end of the lesson, you will be able to:

1. Analyze and explain the structure and syntax of JavaScript


2. Explain what a variable is and how it works in a program

Lesson Proper:

What is JavaScript?

JavaScript is a cross-platform, object-oriented scripting language


used to make webpages interactive (e.g., having complex animations,
clickable buttons, popup menus, etc.).

Why is it called JavaScript?

COMPUTER 10 Page 1
When JavaScript was created, it initially had another name:
“LiveScript”. But Java was very popular at that time, so it was decided
that positioning a new language as a “younger brother” of Java would
help.

But as it evolved, JavaScript became a fully independent language


with its own specification called ECMAScript, and now it has no relation
to Java at all.

JavaScript can be extended for a variety of purposes by supplementing it


with additional objects; for example:

1. Client-side JavaScript extends the core language by supplying


objects to control a browser and it’s Document Object Model
(DOM). For example, client-side extensions allow an application to
place elements on an HTML form and respond to user events such
as mouse clicks, form input, and page navigation.
2. Server-side JavaScript extends the core language by supplying
objects relevant to running JavaScript on a server. For example,
server-side extensions allow an application to communicate with a
database, provide continuity of information from one invocation to
another of the application, or perform file manipulations on a
server.

Structure and Syntax

The following are the set of rules in writing a JavaScript code.

Note: JavaScript is case sensitive. One wrong casing in the codes won’t
make the whole program work that is why it is a good practice to double
check the characters, text and symbols that you use.

1. All keywords should be in lower case.


var a = 2
var A = 3
var a is different from var A

2. JavaScript requires one space between keywords, identifier and


names.
function greet()

3. Every line in a JavaScript code ends with a semi-colon(;)


document.write(“I am programming using JavaScript”);

4. Comments are remarks or notes added to describe certain parts of


codes in a program
// Single line comments

/* example of a
multi-line comment
in JavaScript */

COMPUTER 10 Page 2
General Structure

<html>
Statement is placed between
<head>
<script> and </script>
<title> javascript sample code
</title>
</head>
<body> document.write() displays
whatever string is entered
<script type = “text/javascript”>
inside the parenthesis
document.write (“HELLO between the open and close
WORLD!”); quotation marks “ “.
</script>
</body>

Integrating HTML tags to format text content in JavaScript

<!DOCTYPE html>
<html>
<body>
<script>
document.write("Hello");
document.write("World");
</script>
</body> You will see that there is no space
</html> between the HelloWorld output.

<!DOCTYPE html>
<html>
<body>
<script>
document.write("Hello“ +
“<br>”); • You will observe that a + symbol is
added
document.write("World");
• The html tag <br> is used and is
</script> placed between the “ “.
</body> • The + symbol combines the <br> tag
with the text Hello which is telling
</html> the browser to display the output of
the document.write (“World”) on the
next line.
COMPUTER 10 Page 3
JAVASCRIPT VARIABLES

Variable is a temporary storage that represents a value.

Example:
var x = 5

var is the keyword for variable


x is the variable name or identifier
= is the assignment operator

Rules in naming JavaScript Variables

1. A variable name should begin with a letter such as x, num1.


2. A variable name cannot start with any number such as 3y, 2 num
3. A variable name should not be a JavaScript reserved word such as
delete.
4. A variable name is case sensitive

Example1: What is the result of the following code?

<script type>
OUTPUT:
var x = 5 5
document.write (x)
</script>

Example 2: What is the result of the following code?

<script type>
OUTPUT:
var x = 5
5x
document.write (x):
document.write (“x”);
</script>

COMPUTER 10 Page 4
NAME: __________________________________

SECTION: _______________________________

EXERCISES/ACTIVITIES:

Activity 1:
Enumerate and explain in your own words the following.

1. Rules in naming a variable


1.
2.
3.
4.
5.
2. Rules in writing JavaScript code
1.
2.
3.
4.
5.

Activity 2:
Predict the output of the following. Write your answer in the
box.

A.
<script type>
var x = 21 OUTPUT:

document.write (“x”)
</script>

B.
<script type>
OUTPUT:
var x = 5
document.write (x):
document.write (x);
</script>

COMPUTER 10 Page 5
It’s now time to
evaluate your
learning.

NAME: ______________________________________

SECTION: _____________________________

Multiple Choice.

1. Which type of JavaScript language is ___


A. Object-Oriented
B. Object-Based
C. Assembly-language
D. High-level
2. Which type of JavaScript language is ___
A. Object-Oriented
B. Object-Based
C. Assembly-language
D. High-level
3. Inside which HTML element do we put the JavaScript?
A. <js>
B. <script>
C. <scripting>
D. <javascript>
4. Where is the correct place to insert a JavaScript?
A. The <head> section
B. Both the <head> section and the <body> section are correct
C. The <body> section
D. None of the above
5. How can you add a comment in a JavaScript?
A. <!This is a comment>
B. ‘This is a comment
C. //This is a comment
D. None of the above

JavaScript was initially created as a browser-only language, but it is now


used in many other environments as well.

Today, JavaScript has a unique position as the most widely-adopted


browser language with full integration in HTML/CSS.

There are many languages that get “transpiled” to JavaScript and


provide certain features. It is recommended to take a look at them, at least
briefly, after mastering JavaScript.

COMPUTER 10 Page 6

You might also like