Sunteți pe pagina 1din 14

Java Script

In 1995, Netscape 2.0 (a web browser) was released JavaScript.


JavaScript was designed with a purpose to make web pages dynamic
and more interactive. JavaScript is one of the popular scripting
languages having following features :
(a) It can be used for client and server applications.
(b)It is platform independent which means it can run on any
operating systems (i.e. Linux, Microsoft Windows, Mac OS X etc.).
(c) JavaScript codes are needed to be embedded or referenced into
HTML documents then only it can run on a web browser.
(d)It is an interpreted language.
(e) It is a case-sensitive language and its keywords are in lowercase
only.
Java Script

DIFFERENCE BETWEEN JAVA AND JAVASCRIPT

Some people think that Java and JavaScript are same but both are
two completely different languages.

⮚ Java is a general-purpose object oriented programming


language from Sun Microsystems.

⮚ JavaScript is an object-based scripting language. Script refers


to short programming statements to perform a task.
Java Script

Application of JAVASCRIPT
❑ Developing Multimedia Applications
❑ Create Pages Dynamically
❑ Interact with the User
❑ JavaScript Objects are Similar to Dictionaries

Features of JavaScript
❑ Browser Support
❑ JavaScript can be used on Client Side as well as on Server Side
❑ Functional Programming Language
❑ Support for Objects
❑ Run-time Environment
❑ Vendor-specific Extensions (managed by Mozilla Foundation)
❑ Object Type (Pre define and User define)
Java Script

Writing Java Script


JavaScript Interpreted and run by the
client's browser. Here are some tips to remember
when writing JavaScript commands.
 JavaScript code is case sensitive
 White space between words and tabs are ignored
 Line breaks are ignored except within a statement
 JavaScript statements end with a semi- colon;
Java Script
CLIENT SERVER MODEL
CLIENT
It is a node computer that establishes connection with the server,
collects data from the user, sends it to the server, receives information
from the server and presents it to the user.
SERVER
In the context of client-server model, server is the counter part of client.
It is a computer that serves queries from the client. The programs which
respond to the request of clients are known as server applications. The
computer designed to run server application is known as server
machine. Web server, database server and mail server are some
examples of servers. The Client Server Model is an architecture of
computer network where client and server interact by means of a
network Client gathers data from the user as input and sends request to
the server. Server processes the request and sends the requested
information to the client. Railway reservation system, online banking and
online gaming are examples of client-server model
Java Script
Java Script

CLIENTSIDE JAVASCRIPT Client-side JavaScript refers to JavaScript code


that gets executed by the web browser on the client machine. JavaScript
statements can be embedded in a HTML document that can respond to
events such as mouse clicks, form input, and page navigation etc. without
any network connection.

SERVERSIDE JAVASCRIPT
Server-side JavaScript is also known as LiveWire. Like client-side
JavaScript, server-side JavaScript is also embedded within a HTML
document. When a query is made by the client, web server executes the
script after interpreting it.
Java Script

COMMENTS Comments are the statements that are always ignored by


the interpreter. They are used to give remarks to the statement making it
more readable and understandable to other programmers.
There are two types of comments :

- Single line comment using double-slash (//).


-Multiple lines comment using /* and */ .

-For example :
-// This is a single-line comment.
- /* This is a multiple-line comment. It can be of any length. */
Java Script

LITERALS
Literals refer to the constant values, which are used directly in
JavaScript code.
For example:
a=10;
b=5.7;
document.write(Welcome);
In above statements 10, 5.7,
Welcome are literals.
Java Script

IDENTIFIERS
Identifiers refer to the name of variables, functions, arrays, etc. created by the programmer.

It may be any sequence of characters in uppercase and lowercase letters including numbers or
underscore and dollar sign.

An identifier must not begin with a number and cannot have same name as any of the keywords of
the JavaScript.

Some valid identifiers are :


RollNo
bus_fee
_vp
$amt
Some invalid identifiers are :
to day // Space is not allowed
17nov // must not begin with a number
%age // no special character is allowed
Java Script

RESERVED WORDS OR KEYWORDS Reserved


words are used to give instructions to the JavaScript
interpreter and every reserved word has a specific
meaning. These cannot be used as identifiers in the
program. This means, we cannot use reserved words
as names for variables, arrays, objects, functions and
so on. These words are also known as Keywords
Java Script

In
Java Script

In
Java Script

In

S-ar putea să vă placă și