Introduction of JavaScript

Mehadi Hasan
2 min readMay 4, 2021

JavaScript is most powerful browser based scripting language. Now days it is used an incredible number of high-profile applications.

JavaScript was created in 1995 by Brendan Eich. JavaScript is a dynamic language for its types and operators structure .

Number

String

Boolean

Function

Object (Function, Array, Date RegExp)

Symbol (new in ES2015)

Number

Math.sin() = It gives the numeric number

parseInt() = Convert a string to an integer

parseFloat() = gives floating number (Ignore everything if contain any sign (+, -, .)

NaN = Not a Number

isNaN(‘hello’); // true

isNaN(‘1’); // false

String

For showing or counting single charter we use string.

‘tree’. length (it shows 4)

Other Types

JavaScript has two types of Boolean (‘true’) and (‘false’)

false, 0, empty strings (“”), NaN, null, and undefined all become = false.

Except these all become = true.

Variables

In JavaScript these three keywords of let, const, or var are use to declare ariable:

let x ;

let name = ‘person name’ (for change variable use ‘let’)

const Pi = 3.14 (for fixed vabiable we use ‘const’)

var x ;

var name = ‘person name’ (it does not have any restriction, how will we use whether it is fixed or changeable)

Operators

JavaScript numeric operators are +, -, *, / and remainder operator is %

Comparison Operators

Control structures

if else operator

var name = ‘man’;

if (name === ‘hen’) {

name += ‘ kut-kut’;

} else if (name === ‘man’) {

name += ‘ owa-owa’;

} else {

name += ‘!’;

}

console.log(name);

// man owa owa

if anyone call the variable ‘man’ it answer ‘owa owa’

if anyone call the variable ‘hen’ it answer ‘kut kut’

if anyone call the nothing ‘’ it answer ‘!’

for Loop structure

for (var i = 0; i < 10; i++) {// Loop Will execute 10 times and last value will be 9
}
for (var i = 0; i <= 10; i++) {// Loop Will execute 10 times and last value will be 10}

do while loop

var text = “”;

var i = 0;

do {

text += i + “,”;

i++;

}

while (i < 5);

console.log(text);

//0,1,2,3,4,

--

--

Mehadi Hasan

Hello, I am Mehadi Hasan, Frontend React web Developer. From my little knowledge about JavaScript I am trying to publish somethings.