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/ 25
TLE/ICT 9
Third Quarter Lesson 1 Getting Started with JavaScript What is a Script?
A script is a set of computer instructions or
commands that puts together or connects existing components to accomplish a new related task. Scripts are typically written in plain text form and are interpreted each time they are invoked. What is JavaScript? • It is a scripting language. • It is a powerful client-side scripting language that is interpreted by the web browser. • Enables web developers and designers to build more functional and interactive websites. • Enabled by default in most of the browsers. • Allows webmasters to create cool applications on the pages with relatively easier coding work. What is JavaScript? • Light-weight because unlike server-side scripts, it is directly interpreted by the browser without the need for compiling which allows the webmasters to do all the cool stuff without significantly reducing loading speed. • Readily available at no cost to developers as opposed to platforms such as Flash. Is JavaScript same as Java? • JavaScript was created by Brendan Eich for Netscape, one of the pioneer web browsers. • Originally it was called “Live Script” but then for marketing reasons, it was changed to JavaScript since the Java programming language had become popular. • JavaScript is not associated with Java. More of JavaScript When visiting a JavaScript-enhanced website, you essentially downloaded the HTML code to display the site and all scripts inside it. Most browsers have JavaScript enabled by default, so the scripts run automatically when the page loads or when you trigger a certain action. Characteristics of JavaScript 1. Interpreted Language
JavaScript is what we call an interpreted language
due to the fact that it requires a browser to run. Java – is a programming language that needs its code to be compiled before it can be executed. JavaScript – was created to work together with HTML and requires a web browser in order to run Characteristics of JavaScript 1. Interpreted Language
This is the reason why the JavaScript source code
can easily be seen when you view the source code of a JavaScript-enabled webpage. Characteristics of JavaScript 2. Scripting Language
Scripting languages are treated like programming
languages but they are normally created to perform simple repetitive tasks. Characteristics of JavaScript 2. Scripting Language
They do not come with their own interfaces but
they provide instructions to other programs on what to do. In case of JavaScript, it does not contain the program on how the whole webpage looks like but we can use it to change certain elements of the webpage through the browser. Characteristics of JavaScript 3. Client-Side Scripting
There are two kinds of scripting for the Web:
a. Client-side b. Server-side Characteristics of JavaScript Server-side script – is executed on the actual server machine that hosts the webpage.
Client-side script – is executed on the very machine
that the you are using. Characteristics of JavaScript 4. Object-Oriented Programming
Another advantage of JavaScript is that it presents
to you many things as objects and lets you easily manipulate them. OOP is a programming style that treats every element in a system as an object. In OOP, each object has its associated functions, called methods, which are the things that objects know how to do. What You Already Know To start scripting, you will need some tools. Most likely, the computer/gadget you’re using already has these tools:
• Text Editor – MS Notepad comes with your Windows
operating system. There are also a lot of free text editors available for download in the internet. What You Already Know Most browsers can support JavaScript and have the ability to enable or disable it. Most browsers have set JavaScript to “enabled” by default.
Few important things to know about JavaScript:
• JavaScript is normally embedded in your HTML code so you don’t need modifications on the file extension *.htm or *.html. What You Already Know Few important things to know about JavaScript: • Although you would normally embed JavaScript into you HTML code, in some large scripts, you can save them in a separate file like*.js and load them into your browser by linking. The Key in Understanding JavaScript To improve your learning experience of JavaScript, consider the following pointers: • Learn at an optimal pace and do a lot of practice. Although JavaScript is relatively easier to learn than other scripting languages, it takes a lot of practice to actually get yourself familiar with the language. By learning at an optimal pace, you can ensure that you’ll master the essentials. The Key in Understanding JavaScript • Understand the concept of objects. JavaScript is an object-based language although it is not classified as full-blown OOP. JavaScript has few functions that are not part of objects but most of its functionalities are contained in its objects. To utilize JavaScript effectively is to understand what objects are and how you can manipulate them using methods, parameters and events. The Key in Understanding JavaScript The following terms are inevitably used in JavaScript and in most other programming languages. It is good to have a background on these concepts. • Objects – are items that exist in the browser. The browser window, the page itself, the status bar, and the date and time stored in the browser are all objects. The Key in Understanding JavaScript • Methods – are actions to be performed on or by an object. Methods also represent functions that are designed for a specific purpose like doing math or parsing strings. • Properties – are an existing subsection of an object. It is important to learn these basic concepts in programming. The Key in Understanding JavaScript • Event – something which happens or which is done such as loading a page, holding a mouse over a link, or clicking a link. You can actually write scripts and set them to execute when a specific event occurs. • Parameter – data or other objects which describe the characteristics of an object. The Key in Understanding JavaScript • Type – type of variable such as integers, string, floating point, or Boolean. • Type conversion – the act of converting a variable from one type to another. Note: A script is a set of computer instructions or commands that puts together or connects existing components to accomplish a new related task. JavaScript is a powerful scripting language used to create web functionalities. A text editor and a web browser are the tools needed in JavaScripting. The basic components of JavaScript language are objects, methods and properties. Knowing these components helps you to better understand the use of JavaScript. Liceria Tech
JavaScript QuickStart Guide: The Simplified Beginner's Guide to Building Interactive Websites and Creating Dynamic Functionality Using Hands-On Projects