It’s All About JavaScript

PRa Tik Dev
2 min readMay 5, 2021

Introduction to javascript :

Javascript is a scripting language. It Is also a high-level, lightweight, often just-in-time compiled, and multi-paradigm language. It is an interpreted programming language with object-oriented capabilities. It helps to perform complex features on web pages.

Javascript’s Type :

The Type is the building block of any language. So, javascript has some types. The types of javascript are given below:

They are Number, String, Boolean, Function, Object, Symbole.

Javascript Number :

There are two types of number in javascript: Number and BigInt.

There are some functions in Javascript Number. Such as:

isNaN(): This function helps to test NaN(Not a Number) value. if it uses this global(isNaN()), it will behave unintuitive. We can use this function: Number.isNan().

Example:

Number.isNan():

Number.isNaN(NaN); // true
Number.isNaN('hello'); // false
Number.isNaN('1'); // false
Number.isNaN(undefined); // false
Number.isNaN({}); // false
Number.isNaN([1]) // false
Number.isNaN([1,2]) // false

isNan():

isNaN('hello'); // true
isNaN('1'); // false
isNaN(undefined); // true
isNaN({}); // true
isNaN([1]) // false
isNaN([1,2]) // true

parseInt(): If you want to convert a String to an Integer, you have to use this function.

Example:

parseInt('123'); // 123

parseFloat(): If you want to convert a String to a Float Number, you have to use this function.

Example:

parseFloat('123'); // 123.0

Javascript Math :

If you need to do a mathematical process in javascript, you have to use some function related to Math. Math is not a function object.

There are some functions in Javascript Number. Such as:

Math.abs(): If you want an absolute value of a number, you have to use this function.

Example:

Math.abs('-1');     // 1
Math.abs(-2); // 2
Math.abs(null); // 0
Math.abs(''); // 0
Math.abs([]); // 0
Math.abs([2]); // 2
Math.abs([1,2]); // NaN
Math.abs({}); // NaN
Math.abs('string'); // NaN
Math.abs(); // NaN

Math.celi(): Math.celi() function always rounds a number up to the next largest integer.

Example:

Math.ceil(.95);    // 1
Math.ceil(4); // 4
Math.ceil(7.004); // 8
Math.ceil(-0.95); // -0
Math.ceil(-4); // -4
Math.ceil(-7.004); // -7

Math.sqrt():Math.sqrt() function returns the square root of a number.

Example:

Math.sqrt(9); // 3
Math.sqrt(2); // 1.414213562373095

Math.sqrt(1); // 1
Math.sqrt(0); // 0
Math.sqrt(-1); // NaN
Math.sqrt(-0); // -0

Javascript String :

String represents a sequence of characters. If you want to execute a line with the combination of some characters, you have to use string type. String is a primitive data type.

Example:

const string1 = "It is String Number 1 ";
const string2 = 'It is String Number 2';
const string3 = `It is String Number 3`;

--

--