The most viewed posts

Registry Reviver

Web Development Services

Contact Me

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

How to make a computer secure and run faster

Myanmar font and keyboard for Windows

Advanced System Care

The most viewed items

Dell Inspiron 5559

Desktop Hard Disk

Laptop RAM

SONY Playstation Portable

HP ProBook 430

External Hard Disk

Laptop

Please login to start chat

ZilaStar ICT Dec 05 2019, 16:07:29
Category : JavaScript Tutorials

JavaScript Basic Rules

// 1. JavaScript is case-sensitive

/*
var myTest = "I am Thet Naing Win";
var mytest = "Who are you?"
document.write(mytest);
*/

// 2. All the statements should end in semicolon
/*
var myStatement1 = "I am Thet Naing Win.";
var myStatement2 = "I am from Myanmar.";
var myStatement3 = "I live in Yangon now.";
var myStatement4 = "I am 35 now.";
document.write(myStatement1 + " " + myStatement2 + " " + myStatement3 + " " + myStatement4);
*/

// 3. All the variables mu be defined before using it. The type of data is put into the variables.
/*
var myVar1 = "I am Thet Naing Win."; //String
var myVar2 = "I am 35 now."; //number
document.write(myVar1 + " " + myVar2);
*/

// Global variable and local variable

/*
var tnwGlobal = "I am TNW Global."; //global variable

function myFun1(){
var tnwLocal1 = "I am TNW Local one."; //local variable
document.write(tnwGlobal + "<br />" + tnwLocal1);
}

function myFun2(){
var tnwLocal2 = "I am TNW Local two."; //local variable
document.write(tnwGlobal + "<br />" + tnwLocal2 + "<br />" + tnwLocal1);
}
*/
//Function two does not work as the local variable from myFun1() is being used in myFun2().

// 4. We can use single quotation mark or double quotation mark to declare the strings
/*
var myString1 = "I am Thet Naing Win.";//double quotation mark
var myString2 = 'I am from Myanmar.';//single quotation mark
document.write(myString1 + "<br />" + myString2);
*/

// 5. Varialbe increment or decrement
/*
var a;
a = a + 1; //or
a++;

a = a - 1; //or
a--;
*/
// For example
/*
for(var a = 9; a >= 1; a--){
document.write(a + "<br />");
}
*/

// 6. Comments
// We can use // or /* ------- */

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions