1. JavaScript is the world’s most well known programming language.
  2. JavaScript is the programming language of the Web.
  3. JavaScript is not difficult to learn.

Why Study JavaScript?

JavaScript is one of the 3 languages all web designers should learn:

1. HTML to characterize the substance of pages.

2. CSS to determine the design of site pages.

3. JavaScript to program the conduct of website pages.

JavaScript Introduction

This page contains a few instances of what JavaScript can do.

JavaScript Can Change HTML Content

One of numerous JavaScript HTML strategies is getElementById().

The model underneath “discovers” a HTML component (with id=”demo”), and changes the component content (innerHTML) to “Hi JavaScript”:


document.getElementById(“demo”).innerHTML = “Hi JavaScript”;

JavaScript acknowledges both twofold and single statements:


document.getElementById(‘demo’).innerHTML = ‘Hi JavaScript’;

JavaScript Can Change HTML Attribute Values

In this model JavaScript changes the worth of the src (source) quality of a <img> tag:

The Light Bulb

Turn on the light(image of light bulb) Turn off the light

JavaScript Can Change HTML Styles (CSS)

Changing the style of a HTML component, is a variation of changing a HTML quality:


document.getElementById(“demo”).style.fontSize = “35px”;

JavaScript Can Hide HTML Elements

Concealing HTML components should be possible by changing the presentation style:


document.getElementById(“demo”).style.display = “none”;

JavaScript Can Show HTML Elements

Showing covered up HTML components should likewise be possible by changing the showcase style:


document.getElementById(“demo”).style.display = “block”;

Did You Know?

JavaScript and Java are totally various dialects, both in idea and plan.

JavaScript was imagined by Brendan Eich in 1995, and turned into an ECMA standard in 1997.

ECMA-262 is the authority name of the norm. ECMAScript is the authority name of the language.

JavaScript Syntax

JavaScript grammar is the arrangement of rules, how JavaScript programs are built:

var x, y, z;/Declare Variables
x = 5; y = 6;/Assign Values
z = x + y;/Compute Values

JavaScript Values

The JavaScript punctuation characterizes two kinds of qualities:

  1. Fixed values.
  2. Variable values.

     Fixed qualities are called Literals.

     Variable qualities are called Variables.

JavaScript Literals

The two most significant grammar rules for fixed qualities are:

1. Numbers are composed with or without decimals:

  • 10.50
  • 1001

2. Strings are text, composed inside twofold or single statements:

  • “John Doe”
  • ‘John Doe’

JavaScript Variables

In a programming language, factors are utilized to store information esteems.

JavaScript utilizes the var watchword to announce factors.

An equivalent sign is utilized to dole out qualities to factors.

In this model, x is characterized as a variable. At that point, x is doled out (given) the worth 6:

var x;
x = 6;

JavaScript Operators

  • JavaScript utilizes number arithematic operators ( + – */) to process esteems:
        (5 + 6) * 10
  • JavaScript utilizes assignment operators ( = ) to relegate qualities to factors:
         var x, y;
         x = 5;
         y = 6;

JavaScript Expressions

An expression is a blend of qualities, factors, and administrators, which registers to a worth.

The calculation is called an evaluation.

  • For instance, 5 * 10 assesses to 50:
5 * 10
  • Evaluatons can likewise contain variable qualities:
          x * 10

The qualities can be of different sorts, like numbers and strings.

For instance, “John” + ” + “Doe”, assesses to “John Doe”:

“John” + ” + “Doe”

JavaScript Keywords

JavaScript catchphrases are utilized to distinguish activities to be performed.

  • The var watchword advises the program to make factors:
         var x, y;
         x = 5 + 6;
         y = x * 10;

JavaScript Comments

Not all JavaScript explanations are “executed”.

Code after twofold slices/or between/* and */is treated as a remark.

Remarks are disregarded, and won’t be executed:

var x = 5;/I will be executed
/var x = 6; I won’t be executed

JavaScript Identifiers

Identifiers are names.

In JavaScript, identifiers are utilized to name factors (and catchphrases, and capacities, and marks).

The guidelines for lawful names are a lot of something very similar in most programming dialects.

In JavaScript, the principal character should be a letter, or a highlight (_), or a dollar sign ($).

Ensuing characters might be letters, digits, highlights, or dollar signs.


Numbers are not permitted as the primary character.

This way JavaScript can without much of a stretch recognize identifiers from numbers.

JavaScript is Case Sensitive

All JavaScript identifiers are case delicate.

The factors lastName and lastname, are two unique factors:

var lastname, lastName;
lastName = “Doe”;
lastname = “Peterson”;


JavaScript doesn’t decipher VAR or Var as the watchword var.

JavaScript and Camel Case

Generally, software engineers have utilized various methods of joining different words into one variable name:


first-name, last-name, master-card, inter-city.


Hyphens are not permitted in JavaScript. They are saved for deductions.

  • Underscore:

          first_name, last-name, master-card, inter-city.

  • Upper Camel Case (Pascal Case):

          FirstName, LastName, MasterCard, InterCity.

  • Lower Camel Case:

         JavaScript software engineers will in general utilize camel case  

         that begins with a lowercase letter:

         firstName, lastName, masterCard, interCity.

JavaScript Character Set

JavaScript utilizes the Unicode character se

Unicode covers (nearly) every one of the characters, accentuations, and images on the planet.

For a more critical look, if it’s not too much trouble, study our Complete Unicode Reference.(link to be entered here)

JavaScript Statements


var x, y, z;/Statement 1
x = 5;/Statement 2
y = 6;/Statement 3
z = x + y;/Statement 4

JavaScript Programs

A PC program is a rundown of “guidelines” to be “executed” by a PC.

In a programming language, these programming directions are called explanations.

A JavaScript program is a rundown of programming explanations.


In HTML, JavaScript programs are executed by the internet browser.

JavaScript Statements

JavaScript explanations are made out of:

Qualities, Operators, Expressions, Keywords, and Comments.

This assertion advises the program to state “Hi Dolly.” inside a HTML component with id=”demo”:


document.getElementById(“demo”).innerHTML = “Hi Dolly.”;

Most JavaScript programs contain numerous JavaScript articulations.

The assertions are executed, individually, in a similar request as they are composed.


JavaScript projects (and JavaScript explanations) are regularly called JavaScript code.

Semicolons ;

Semicolons separate JavaScript articulations.

Add a semicolon toward the finish of each executable assertion:

var a, b, c;/Declare 3 factors
a = 5;/Assign the worth 5 to a
b = 6;/Assign the worth 6 to b
c = a + b;/Assign the amount of an and b to c

At the point when isolated by semicolons, numerous assertions on one line are permitted:

a = 5; b = 6; c = a + b;


On the web, you may see models without semicolons.

Finishing articulations with semicolon isn’t needed, yet enthusiastically suggested.

JavaScript White Space

JavaScript disregards various spaces. You can add void area to your content to make it more comprehensible.

The accompanying lines are same:

var individual = “Hege”;
var person=”Hege”;

A decent practice is to put spaces around administrators ( = + – */):

var x = y + z;

JavaScript Line Length and Line Breaks

For best clarity, software engineers regularly prefer to keep away from code lines longer than 80 characters.

In the event that a JavaScript articulation doesn’t fit on one line, the best spot to break it is after an administrator:


document.getElementById(“demo”).innerHTML =
“Hi Dolly!”;

JavaScript Code Blocks

JavaScript proclamations can be gathered in code blocks, inside wavy sections {…}.

The motivation behind code blocks is to characterize articulations to be executed together.

One spot you will discover articulations assembled in blocks, is in JavaScript capacities:


work myFunction() {
document.getElementById(“demo1”).innerHTML = “Hi Dolly!”;
document.getElementById(“demo2”).innerHTML = “How are you?”;}

JavaScript Keywords

JavaScript statements frequently start with a keyword to recognize the JavaScript activity to be performed.

Here is a rundown of a portion of the catchphrases you will find out about in this instructional exercise:

breakTerminates a switch or a circle
continueJumps out of a circle and starts at the top
debuggerStops the execution of JavaScript, and calls (if accessible) the troubleshooting capacity
do … whileExecutes a square of proclamations, and rehashes the square, while a condition is valid
forMarks a square of articulations to be executed, up to a condition is valid
functionDeclares a capacity
in the event that … elseMarks a square of explanations to be executed, contingent upon a condition
returnExits a capacity
switchMarks a square of proclamations to be executed, contingent upon various cases
attempt … catchImplements mistake dealing with to a square of articulations
varDeclares a variable

NOTE: JavaScript watchwords are held words. Saved words can’t be utilized as names for factors. Visit for more information.


So this was all about javascript, I hope you got all the basic and necessary information about javascript and this much knowledge about javascript is enough for you to learn in the beginning.

2 thoughts on “JAVA SCRIPT”

  1. Pingback: TOP 10 MOST POPULAR PROGRAMMING LANGUAGES - Freelancer Mind

  2. Pingback: LOOPS IN JAVASCRIPT - Freelancer Mind

Leave a Comment

Your email address will not be published. Required fields are marked *