web-students

JavaScript - Day 2

variables, conditions, alert

JavaScript is a programming language. Hence the basic programming language constructs are also available. Using them you can create things like mathematical calculations etc.

Variables

Use let, const, var to declare them.

var i = 10; //in a file everywhere accessible and can change

let j = 20; //local and can change

const k = 30; //Can't change

Functions

//without parameter
function Hi(){
    return 'Hi there!!'
}

//with parameter
function SayHello(name){
    return 'Hello ' + name;
}

//to call 
Hi();
SayHello('Wriju');

Operators

+
-
* 
/

Alert

alert('Hello')

var i = 10;
alert(i)

JavaScript Assignment #2


Home

Next: JavaScript Day 3 »