Shafayat Tazoar Afi
3 min readNov 2, 2020

--

Introduction To JavaScript
JavaScript

Introduction to JavaScript: JavaScript is a programming language that helps you to make a interactive website. In short it is called JS. It is a dynamic programming language. Though it is a language that is misunderstood a lot but it is used at a huge rate for building a website. JS was introduced in 1995 first. Now every year a latest version of JS is being published. ES6 version of JS is very much popular among the developers around the world.

From the knowledge that I have gained through internet, there are some type of JS that manipulates values are Number, String, Boolean, Function, Object, Symbol, Null, Undefined etc. The objects are of 4 kinds those are Function, Array, Date, RegExp. Now let’s get introduced with some of these topics.

Number: JavaScript Numbers are 64 bit floating point. The can be written in decimal or in other format. It is always written as “ Number(value) ” format. It returns only the value which is written inside the first braces. If the value inside the first braces is not a number in any format the function will return “NaN” which means “Not a number”. “isNan()” is another function which return if the value is a number or not. “parseInt()” is used to convert a string into a integer and “parseFloat()” is used to convert a string into a float. There is also an “isFinite()” function that defines if the value is finite or not.

String: The string object in JavaScript represents characters. ‘length’, ‘indexOf()’, ‘subString()’, ‘+’, ‘+=’ are some methods or operations thar can be applied on string. ‘charAt()’, ‘replace()’, ‘toUpperCase()’, ‘toLowerCase()’ are also some operations of string.

Variables: The variables in JavaScript are of ‘let’, ‘var’ and ‘const’ types. ‘let’ is declared as a block level variable. ‘const’ is declared as a variable that can never be changed. But ‘var’ has no such restrictions and it can be used as any types. ‘let’ and ‘const’ are being introduced in ES6.

Operators: Operators in JS are simple as other programming languages. You can use ‘+, -, ==, ===’ and many other operators that we use for mathematical terms and for logical works.

Conditional Statements: You can use ‘If..else..’ condition for many of the conditional cases like other programming languages. ‘Do..while..loop’ and ‘for loop’ are also being used. But JS have some special loop format like ‘for of loop’ and ‘for in loop’. ‘Switch..case’ can also been used.

Objects: JavaScript objects can be thought of a simple key, value pair. Everything in JS is an object. JS object is very vastly used and it is also related to OOP. Many problems can be easily solved by using object and constructor.

Arrays: Array is also one kind of object in JavaScript. It can store numbers, string and many other types of variable in it. Some methods of array in JS is ‘toString()’, ‘toLocalString()’, ‘contact()’, ‘join()’, ‘push()’, ‘pop()’, ‘shift()’, ‘unshift()’, ‘slice()’, ‘sort()’, ‘splice()’, ‘reverse()’ etc.

Function: This is also one kind of object in JS. Function is a block of code which is designed to do a fixed task. For many tasks you can generate as many functions as you want. A functions has a name and it can take many parameters. Function has to return a value according to it’s tasks.

Math: Math in JS is under the Number type. This is a built in object that contains mathematical methods. ‘E’, ‘LN2’, ‘LN10’, ‘LOG10E’, ‘LOG2E’, ‘PI’, ‘SQRT1_2’, ‘SQRT2’, ‘sin’, ‘cos’, ‘floor’, ‘pow’ are some methods of Math.

this: ‘this’ is a keyword that is refers to define a current object. You can make your code much cleaner and readable by using ‘this’ keyword and it makes the work more easy.

--

--