Important JavaScript Values for Beginners

JavaScript is the world’s most popular and widely used programming language. Basically, JavaScript used to build dynamic client-side webpages. But recently it is also using to complete backend side solution. Which is used NodeJS.

This interesting language was invented by Brendan Eich in 1995 and it was first released in 1996. First time it was called Live Script. JavaScript is also known as ECMAScript.

Basic Overview of JavaScript:

JavaScript is a dynamic, multi-paradigm object-oriented programming language. Besides these JavaScript also support functional programming. Here are some JavaScript value types are given below:

· Number

· String

· Boolean

· Symbol

· Function

· Object (Function, Array, Date, RegExp)

Number is an ancient or old object of javascript it represents different categories numbers like 26 and 0.25. Number convert different values to the Number( ) function

Number(value) converts any string value to Number and if there is no number inside the string or it cannot be converted it will return NaN example:

const num = Number('123')console.log(num)
const num1 = Number('0.23')console.log(num1)const num2 = Number('javascript')console.log(num2)

Number function has different valuable methods here are some important methods are given below.

· isNaN

· parseFloat

· ParseInt

strings can easily represent data in text form. It is a sequence of Unicode characters in JavaScript and each code unit represents 16-bit number. Strings also have some important methods.

· charAt

· concat

· includes

· endsWith

· indexOf

· lastIndexOf

· replace

· slice

· split

· toLowerCase

· toUpperCase

· trim and more….

1. String.charAt( )

This string return new string consisting of single 16-bit code unit. Here is a example

const sentence = 'JavaScript is the most valuable and wonderful programming language.';const index = 4;console.log(`The character at index ${index} is ${sentence.charAt(index)}`);value is ‘The character at index 4 is S’

2. String.indexOf( )

This method return index value of calling string object with its present specified values. And if it does not found any value it will return -1 value.

const line = 'Most valuable and wonderful programming language';const indexOf = line.indexOf('valuable');console.log(indexOf);

3. String.lastIndexOf( )

This method return the index value of calling string object of the last inserted value from the line and it searches its value from backward. If does not found any value it will return -1 value.

const line = 'Most valuable and wonderful programming language is valuable javascript';const indexOf = line.lastIndexOf('valuable');console.log(indexOf);

4. String.slice( )

This method extracts a string section from the line which we defined in the code then it provides another new string without changing the original string code.

const line = 'Most valuable and wonderful programming language';console.log(line.slice(18));

5. String.replace( )

Replace method helps to replace a new string with another old string from the line. Actually, it will not change the full string original string will be unchanged.

const line = 'Most valuable and wonderful programming language';console.log(line.replace('wonderful', 'effective'));

6. String.split( )

This method helps to divide the actual string into substrings then keep those substrings into an array and return them.

const line = 'Most valuable and wonderful programming language';const words = line.split(' ');console.log(words[3]);const chars = line.split('');console.log(chars[8]);

Arrays is another special type of objects in JavaScript. JavaScript array declare with [ ] this syntax. Array has different sub category.

· concat

· filter

· find

· join

· pop

· push

· reduce

· shift

· slice and more.

1. Array.concat( ):

Concat method helps to merge two, three more arrays into one array. Existing array remain unchanged but it completely return new merged array. Example:

const array1 = ['1', '2', '3'];const array2 = ['4', '5', '6'];const array3 = array1.concat(array2);console.log(array3);

2. Array.pop( )

if you have really long array and you want remove last element from that array this pop method will help to remove. Example:

const friends = ['karim', 'rahim', 'kader', 'kamel', 'jamal'];console.log(friends.pop());console.log(friends);

3. Array.push( )

This is the alternative of pop method it will add new elemant end of the array so here is nothing to understand about this array. Example:

const friends = ['karim', 'rahim', 'kader', 'kamel'];console.log(friends.push('jamal'));console.log(friends);


This is the built-in object in javascript. It has some fixed values properties and method for methematical solution. Here are some Math properties given below:

· Math.abs( )

· Math.floor( )

· Math.ceil( )

· Math.max( )

· Math.random( )

· Math.round( ) and more.

1. Math.floor( )

This is very useful math property. This function returns given integers less number or equal number. Example:


2. Math.ceil( )

This is also opposite of math.floor because it returns given integers largest number. For example:


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store