Monday, 22 February 2016

Javascript - Programs Basic

Javascript Programs
In a programming language, computer program instructions are called statements.
JavaScript is a programming language and JavaScript statements are separated by semicolons.

var a = 1;
var b = 2;
var c = a + b;

And next is the javascript statements, and it includes 

  • values
  • operators
  • expressions
  • keywords and 
  • comments

JS Values:
JS values are two types, literals (fixed values) and variables

Numbers - 10.50,100
String - with single or double quote"name"

Variables are used to store data values. JS uses var keyword to assign variables.
var x;

JS uses an assignment operator ( = ) to assign values to variables: 
var a=90;
JS uses arithmetic operators ( + - *  / ) to compute values: 
a * 10 (expressions)
also in string level
 "Mark" + " " + "Layer", evaluates to "Mark Layer":

Code after double slashes // or between /* and */ is treated as a comment.Comments are ignored, and will not be executed:

var a = 50;   // I will be executed

// var a = 50;   I will NOT be executed

JS Statements:
JS statement tells the browser to write "I am in." inside an HTML element with id="example":
document.getElementById("example").innerHTML = "I am in.";

One program example:

var a = 5;
var b = 6;
var c = a + b;
document.getElementById("example").innerHTML = c;


  1. All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates…

    SAP Training in Chennai

  2. In my search for online SAP training, I bumped into Highly recommend this course to anyone struggling with understanding of SAP Basis.
    SAP Hana training in hyderabad