Professional Documents
Culture Documents
.NET 2
Quarter 4 – Module 1:
INTRODUCTION TO JAVASCRIPT
Development Team:
Writer: Randy T. Mercado
Reviewer: Marife P. De Castro
Layout: Paulo Stephen Cadawas
Management: Dr. Edwin T. Casila, MCL – Principal
Christian D. Manalansan – President
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 1 of 14
Dear Parents,
Mind and Integrity College, Inc. is one with every Filipino family in coping with the
demands of our modern times amidst the threat of COVID-19 pandemic.
The school initiated the distribution of a Self-Learning Module (SLM) in order to meet the
essential learning competencies required to be learned by your child whether your child opts for
online, modular, or blended learning modality. The learning activities in this SLM are arranged
chronologically from simple to complex that will lead your child to think critically, act skillfully,
and reflect deeply on each lesson and to practice them into real life settings. Most importantly,
this SLM promotes self-paced learning as your child can always review the least understood
lessons as often as he/she pleases.
Thank you in advance for being one with us! Together, let us envision that, by the end of
this school year, we will see your child as one responsible young person with a heart and mind
for humanity, for nature, for the country, and for God.
Dear Learner,
This is our gift to you. The school initiated the distribution of Self-Learning Modules
(SLM) that will help you keep up with the lesson whether you opted for online, modular, or
blended learning as a modality.
Please take time to read and do the activities in these SLM as if you are reporting in
school. Set a regular study schedule for you as much as possible, but keep in mind that these
SLM will enable you to learn at your own pace. If you do not understand a lesson, the SLM
would not mind you flipping back the pages repeatedly for review. Also, remember to keep in
touch with your teachers. Send them a message through your online sessions or write them a
note as you do your modular activities.
We wish you good luck in your studies, and we hope that you will remain happy and
enthusiastic in learning!
NOTE: Prepare yellow pad papers where you would write all your outputs for this
module. Do not forget to label your works properly corresponding to the title of each
activity. Also, please label your work with module number and module title. Do not forget
to write your name, section and the date of first entry.
Make sure to clip/staple your works so that they will not easily be separated. It is advised
to take down notes about the important information from each lesson because of the
modules will be returned at the end of every week. Please do not write anything on
module.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 2 of 14
What This Module is About
Fast and efficient processing of two-dimensional arrays is essential in land-change modeling
because of the substantial computational effort expended by some computer land change models in
processing raster-graphic images and other two-dimensional arrays. Elapsed, wall-clock runtimes
for spatially explicit land-change models often span days or weeks, so improvements in the speed
and efficiency of a land-change model’s executable computer code can reduce its runtime by hours
or even days. The speed of execution can make the difference between a model that is fast enough
to be used and one that is not. Computational speed and efficiency in array processing are
fundamental, threshold concerns in land-change modeling and other areas of scientific
computation.
What’s In This part connects previous lesson with that of the current
one.
What’s More These are follow-up activities that are in- tended for you
to practice further in order to master the competencies.
What I can do These are tasks that are designed to show- case your
skills and knowledge gained and applied into real-life
concerns and situations.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 3 of 14
WHAT I KNOW
Instruction: Identify the following. Write your answer on a yellow pad paper.
1. This is the art of creating sites and web applications that render on the client-side.
2. This consists of a server, an application, and a database.
3. Through this, code runs in browser after page is sent back from server often this code manipulates the
page or responds to user actions.
4. This is a benefit of using client – side scripting where it can modify a page without having to post back to
the server.
5. It allows us to create dynamic web pages.
6. This is a benefit of using client – side scripting where it can respond to user actions like clicks and key
presses.
7. It is a client-side scripting language, which means the source code is processed by the client's web
browser rather than on the web server.
8. Is Java and JavaScript related to each other? (Write only Yes or No).
9. This should be placed in HTML page's head.
10. This is writing programs driven by user events.
INTRODUCTION
It’s estimated that over 1.7 billion websites exist, but this number fluctuates daily, as websites are launched
or lost. Despite the ebb and flow, the Web is massive and 4.5 billion people across the world contribute with online
interactions.
Websites are now a critical component for any business to stay competitive. And as web development
trends and best practices change practically with the season, there’s no shortage of work for developers.
But how do you know exactly what kind of web development work to seek out and train for? If you’ve
poked around on job listing sites or browsed through online courses, you’ve probably gathered that web
development tends to break down into three main concentrations: front-end, back-end, and full stack.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 4 of 14
great-looking content no matter the device, and libraries like jQuery and LESS, which package code into a more
useful, time-saving form. A lot of front-end developer job listings also call for experience with Ajax, a widely used
technique for using JavaScript that lets pages dynamically load by downloading server data in the background.
So what makes the front end of a website possible? Where is all that data stored? This is where the back
end comes in. The back end of a website consists of a server, an application, and a database. A back-end developer
builds and maintains the technology that powers those components which, together, enable the user-facing side of
the website to even exist in the first place.
While front-end development is about making sites and web applications render on the client-side, back-
end development is all about making these apps render server-side. But it's a bit more involved than that. While
the previous statement holds true, back-end developers also create services that process business logic and access
other resources such as databases, file servers, cloud services and more. These services are the backbone of any
application and can be accessed and used not only by server-side rendering apps but also from client-side
rendering apps.
In order to make the server, application, and database communicate with each other, back-end developers
use server-side languages like PHP, Ruby, Python, Java, and .Net to build an application, and tools like MySQL,
Oracle, and SQL Server to find, save, or change data and serve it back to the user in front-end code. Job openings for
back-end developers often also call for experience with PHP frameworks like Zend, Symfony, and CakePHP;
experience with version control software like SVN, CVS, or Git; and experience with Linux as a development and
deployment system.
Back-end developers use these tools to create or contribute to web applications with clean, portable, well-
documented code. But before writing that code, they need to collaborate with business stakeholders to understand
their particular needs, then translate those into technical requirements and come up with the most effective and
efficient solution for architecting the technology.
There’s often not a black-and-white distinction between front-end and back-end development. “Front-end
developers often need to learn those additional back-end skills, and vice versa, especially in the current economy
where marketing is thinly resourced,” said Matranga. “Developers need some of that cross-discipline. Oftentimes,
you have to be a generalist.”
The role was popularized seven years ago by Facebook’s engineering department. The idea is that a full
stack developer can work cross-functionally on the full “stack” of technology, i.e. both the front end and back end.
Full stack developers offer the full package.
“Working on both the server side and client side professionally opens more opportunities,” said Federico Ulfo,
Full Stack Developer at Grovo. But, of course, full stack development isn’t without its challenges. “To make an
analogy with food, you can be good at cooking or good at baking, but mastering both takes time and experience.
And I’m not talking about following a recipe, anyone can do that. I’m talking about having the ingredients to
prepare something truly good.”
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 5 of 14
CLIENT – SIDE SCRIPTING
Client – side script: code runs in browser after page is sent back from server often this code manipulates the page
or responds to user actions.
PHP already allows us to create dynamic web pages. Why also use client-side scripting?
Usability: can modify a page without having to post back to the server (faster UI)
Efficiency: can make small, quick changes to page without waiting for server
Event-driven: can respond to user actions like clicks and key presses
Security: has access to server's private data; client can't see source code
Power: can write files, open connections to servers, connect to databases, etc.
JAVASCRIPT
Client-side scripting language, which means the source code is processed by the client's web browser
rather than on the web server.
This means JavaScript functions can run after a webpage has loaded without communicating with the
server. For example, a JavaScript function may check a web form before it is submitted to make sure all the
required fields have been filled out.
The JavaScript code can produce an error message before any information is actually transmitted to the
server.
A lightweight programming language ("scripting language")
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 6 of 14
Used to make web pages interactive
Insert dynamic text into html (ex: user name)
React to events (ex: page load user click)
Get information about a user's computer (ex: browser type)
Perform calculations on user's computer (ex: form validation)
A web standard (but not supported identically by all browsers)
NOT related to java other than by name and some syntactic similarities
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 7 of 14
You are used to programs start with a main method (or implicit main like in PHP)
JavaScript programs instead wait for user actions called events and respond to them
Event-driven programming: writing programs driven by user events
Let's write a page with a clickable button that pops up a "Hello, World" window.
BUTTONS
JavaScript functions
function name() {
statement ;
statement ;
...
statement ;
} JS
function myFunction() {
alert("Hello!");
alert("How are you?");
} JS
EVENT HANDLERS
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 8 of 14
e.g. see whether a box is checked
we can change state
e.g. insert some new text into a div
we can change styles
e.g. make a paragraph red
every element on the page has a corresponding DOM object access/modify the attributes of the DOM object
with objectName.attributeName
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 9 of 14
CHANGING ELEMENT STYLE: element.style
color color
padding padding
background-color backgroundColor
border-top-width borderTopWidth
VARIABLES
Integers and real numbers are the same type (no int vs. Double)
Same operators: + - * / % ++ -- = += -= *= /= %=
Similar precedence to java
Many operators auto-convert types: "2" * 3 is 6
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 10 of 14
COMMENT (Same as JAVA/C++)
MATH OBJECT
methods: abs, ceil, cos, floor, log, max, min, pow, random, round, sin, sqrt, tan
properties: E, PI
LOGICAL OPERATORS
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 11 of 14
BOOLEAN TYPE
FOR LOOP
WHILE LOOPS
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 12 of 14
POP – UP BOXES
ARRAYS
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 13 of 14
Methods: charAt, charCodeAt, fromCharCode, indexOf, lastIndexOf, replace, split, substring, toLowerCase,
toUpperCase
Concatenation with + :
What’s New
Activity 1: PERFORMANCE ACTIVITY
Instruction: Write an HTML and CSS file of your own design for login system. Write your code on a yellow pad
paper.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 14 of 14