Some useful technique of using Number and String in JavaScript

Sultana Tasnim Jahan
4 min readMay 5, 2021


JavaScript is a lightweight, interpreted programming language.

Types in JavaScript

Number: Number is a type in javaScript. The range of number value is= From (253 − 1) to 253–1.

The largest positive number in JavaScript = (253–1).

To see in editor=

The largest positive number in JavaScript = –(253–1).

To see in editor=

infinity and Infinity number

JavaScript has infinity and Infinity number:

Infinity number = 1/0 ,

-Infinity number = -1/0

Topics are:

Convert to another type

We can convert any other types of number value to an integer value. Example:

§ Convert binary to decimal number =

§ Convert string to number=

§ Convert octal to number:


We can find the absolute value of a number using Math.abs

Math.ceil(x) , Math.floor(x)

To get the upper and lower integer value of a floating-point number, use ceil and floor

Math.max(x,y,…), Math.min(x,y,…)

Find the minimum and maximum number from numbers =

Find the minimum and maximum number from an Array =

We can find the minimum number in the same way.


We can find a random number in an array. To find a random number


We can find around value. The Math.round() function returns the value of a number rounded to the nearest integer.


The Math.sqrt() function returns the square root of a number. Sqr value is the root value of a number. We can find it by using sqrt(). But it must be a number.


A string is a data type used in programming language. It is a set of characters that can also contain spaces and numbers.

Topics are:

String values have to put in “ ” / ‘ ’/` `.



It is used to add to a string


includes is used to check if the word is there or not.


to find the position of the word or letter.


To replace a word or sentence. Example:



Trim removes all space, tab, break space, etc.



Sultana Tasnim Jahan

I love to take a challenge and to be successful by working hard and love to learn and gain new experiences.