Start Learning JavaScript Today

rafee abdullah
3 min readMay 5, 2021
A journey with JavaScript

JavaScript String:

String is a basic data type of JavaScript that holds the character array. A collection of character is called string. For example, lets “JavaScript is a programming language” be a string. Let store the above string in a variable named firstString. Therefore,

const firstString = “JavaScript is a programming language”;

If we want to access a character of the string we can access it in two ways.

const first= firstString[0] // return J

const charfirst = firstString.charAt(1) // return a

Concat method: concat is applied to merge two or more strings together .

const first =” hello”;

const second = “there”;

const final = concat(first,second);

console.log( “Concating two strings” + first + “ ” +second);

IndexOf():

Returns the first appearance of a string in another string.

const firstString = “JavaScript is a programming language”;

const searchIndex = firstString.indexOf(“is”); // return 11

array.concat()

array.concat() method is used to merge two or more arrays and converting a single array without changing the existing arrays. Existing arrays remain the same and return a new array.

BigInt:

JavaScript Support BigInt that can store incredibly large number. Operators like +,-,*,/ ,% can be also used with BigInt. A BigInt is not strictly equal to a Number, but it is loosely so.

JavaScript Math:

Math is built in function that let you do the mathematics in a easier way. You have lots of built in math functions there where you can just put your value and get the output..

example:

Math.abs(x) // returns the absolute value of x

if you put and string in abs function you will get that it is not a number that in NaN

Math.max([1,2,3,4,5]);

returns the maximum value of the array

similarly Math.min() returns the minimum value of an array or the comparison of two or more numbers

Math.pow(x,y) // return x^y

JavaScript supports two types of Number.

  1. Integer
  2. Floating

123 // int type number

123.00 // floating type data

There are methods to make a string a number. That is

Number(‘124’) // returns 124

There are also ceil and floor method

Math.ceil(3/2) // returns 2

precise to the nest integer Number

Math.floor(3/2) //returns 1

precise to the previous int Number

Thank you for reading so far…

--

--