Introduction To JavaScript
Introduction To JavaScript
What is JavaScript?
JavaScript is a widely used web-based programming language that powers the dynamic
behavior on most websites.
It was designed to add interactivity and functionality to the web site.
What is Scripting?
Scripting language means that it is interpreted by another program at runtime rather than
compiled by the computer’s processor as another programing languages are.
Features of JavaScript
It supports all structured programming syntax in C.
It has dynamic typing.
It can run locally on a website.
It can detect user-action.
It can be combined with CSS to produce DHTML
Disadvantages of JavaScript
Some browsers do not support JS.
Any secret embedded in JS could be extracted by a determined adversary.
JS and DOM provide the potential for malicious authors to deliver scripts to run on a client
computer via the web.
Web Site authors cannot perfectly conceal how their JS operates.
Source code that have been deliberately made hard to understand can be reverse engineered.
Remember:
JS is object-based language. Every object has its own method or property.
Example: document.write (“Hi”);
Document is the object name,
Write is the method
Hi is the parameters
External JavaScript
You can place an external script reference in <head> or <body> as you like.
The script will behave as if it was located exactly where the <script> tag is located.
External scripts cannot contain <script> tags.
Use the file extension name .js and src attribute.
Comments
Use // for single line comment
/* */ for multiple line comments