Académique Documents
Professionnel Documents
Culture Documents
What is Javascript?
JavaScript adds interactivity to HTML pages.
JavaScript is a lightweight scripting
programming language.
A JavaScript is usually embedded directly into
HTML pages.
JavaScript is an interpreted language. The
scripts execute without preliminary compilation.
No License is required to use Javascript
SpringPeople Software Private Limited, All Rights Reserved.
JavaScript Functions
A JavaScript function is a block of code designed to perform a
particular task.
A JavaScript function is executed when "something" invokes it
(calls it).
A JavaScript function is defined with the function keyword,
followed by a name, followed by parentheses ().
Function names can contain letters, digits, underscores, and
dollar signs (same rules as variables).
The parentheses may include parameter names separated by
commas: (parameter1, parameter2, ...)
The code to be executed, by the function, is placed inside
curly brackets: {}
SpringPeople Software Private Limited, All Rights Reserved.
Closures In Javascript
A closure is an inner function that has access to the outer
(enclosing) functions variablesscope chain. The closure has
three scope chains: it has access to its own scope (variables
defined between its curly brackets), it has access to the outer
functions variables, and it has access to the global variables.
The inner function has access not only to the outer functions
variables, but also to the outer functions parameters. Note
that the inner function cannot call the outer
functions argumentsobject, however, even though it can call
the outer functions parameters directly.
Object-Oriented JavaScript
Object Oriented Programming (OOP) refers to using self-contained
pieces of code to develop applications. We call these self-contained
pieces of code objects, better known as Classes in most OOP
programming languages and Functions in JavaScript. We use
objects as building blocks for our applications. Building applications
with objects allows us to adopt some valuable techniques,
namely, Inheritance (objects can inherit features from other
objects), Polymorphism (objects can share the same interface
how they are accessed and usedwhile their underlying
implementation
of
the
interface
may
differ),
and Encapsulation (each object is responsible for specific tasks).
JavaScript Variables
Like many other programming languages, JavaScript has
variables. Variables can be thought of as named containers.
You can place data into these containers and then refer to the
data simply by naming the container.
The scope of a variable is the region of your program in which
it is defined. JavaScript variable will have only two scopes.
Global Variables: A global variable has global scope which
means it is defined everywhere in your JavaScript code.
Local Variables: A local variable will be visible only within a
function where it is defined. Function parameters are always
local to that function.
JavaScript templates
Javascript templates are rendered and cached client-side
without sending an HTTP request to the server in other
words, theyre lightning fast.
An alternative approach to XUL's own templating system is to
use JavaScript templates.
This approach also provides a separation of formatting and
structure from content, but relies on a JavaScript templating
engine to have JavaScript-side business logic inject content
into a template. And this does not require any use of
RDF/XML, etc.
More Details
Syllabus
Our Partners