Chapter 1 Lesson 1 PDF
Chapter 1 Lesson 1 PDF
Chapter 1 Lesson 1 PDF
Chapter 1
Lesson 1
Exploring the
JavaScript Language
Writing a JavaScript
Program
Objectives
Figure 1-1
JavaScript and ECMAScript
• Developers struggled to reconcile JavaScript and
JScript in the late 1990s
• JavaScript was submitted as a proposal for a
standardized scripting language to the European
Computer Manufacturers Association (ECMA) in
1997
• An ECMA committee developed a set of scripting
language standards
• The specification for this scripting language, called
ECMAScript (ECMA-262), is updated to a new
edition annually
The DOM and The BOM
• Three foundations of the full implementation of JavaScript:
– ECMAScript (core of the language: syntax, keywords, properties, methods, etc.)
– Document Object Model (DOM): describes how to access the contents of a
web page and user actions within that page
– Browser Object Model (BOM): describes how to access the features and
behaviors of the browser itself
• DOM and BOM are Application Programming Interfaces (APIs)
• DOM specifications are managed by the World Wide Web
Consortium (W3C)
– Current version is DOM Level 4, described as an ongoing “living standard”
• BOM is implemented by each browser application (largely the same
among them)
Understanding Client/Server Architecture
• Traditionally, a two-tier system consisting of:
– Server (back end): a device or application from which a
client requests information; responsible for data storage,
management, communication with external services, and
heavy processing
– Client (front end): a device or application that presents
an interface to the user and requests information from a
server; responsible for gathering information from the
user, submitting it to a server, then receiving, formatting,
and presenting the results, and sometimes some related
data processing
Understanding Client/Server Architecture
(continued 1)
• Web’s two-tier client/server system consists of a
web browser and web server that communicate via
Hypertext Transfer Protocol (HTTP)
Figure 1-4
Understanding Client/Server Architecture
(continued 2)
• Adding databases and other applications to a web server
yields a three-tier client/server system (a.k.a. multitier
client/server system, n-tier client/server system): client
tier, processing tier (a.k.a. middle tier), and data storage
tier
Figure 1-5
JavaScript and Client-side Scripting
Figure 1-6
Should you use client-side or server-side
scripting?
• Allow the client to handle the user interface processing and
other light processing such as data validation
• Allow the web server to perform intensive calculations and
data storage
• Performing some processing on the client is beneficial
because:
– Processing power is not limited to the capabilities of the server
when processing is distributed among multiple client devices using
a web application
– Transfer times across the Internet are minimized, increasing
speed
– Server resource requirements (infrastructure, power use) are
decreased, reducing costs
Writing a JavaScript Program - IDEs and Code
Editors