Core concepts of javascript

Numan Ahmed
2 min readMay 5, 2021

Javascript has lots of core concepts. Here I will discuss some core concepts. Javascript has 8 types. Types are:

  1. String
  2. Number
  3. Boolean
  4. Symbol
  5. Objects (inside: 1. Functions 2. array 3. Date 4. RegExp)
  6. null
  7. undefined
  8. Error

These are the types of javascript. Here I will try to describe Array, Number, String, and Math.

Array

The array is an exceptional type of object in JavaScript. It declares with [] brackets. It has lots of methods. Here some examples:

1. Concat()

This method basically used for merging two or more arrays in one. It didn’t change any value from existing arrays, it grave values from the one and respectively then add it on the merged array.

2. Map()

Map method used for creating a new array from any existing array. It allows building an array by using it. The map method provides a callback function for each new element.

3. Slice()

The slice method creates new by cutting a portion on an existing array. It takes 2 parameters value start and end value for to cut the array.

String

The string is a list of javascript Unicode sequence characters. It has lots of methods. Here some examples:

1. Substr()

This string method returns a portion of the string with provided index. It finds string depends on the index of characters.

2. Replace()

Replace method used for replacing an existing string with a portion or all replaced with new code. It returns a new string.

3. IndexOf()

IndexOf method returns the position of any string. Position starts from index 0. If the position didn’t exist then the indexOf() method returns the value “undefined”.

Number

ECMAScript has two numeric types one Number and the other BigInt. The number contains constant and method to work with numbers. Numbers have lots of working method, here some examples:

1. IsNaN()

IsNaN method used for checking Number type is it number or not. If a provided number value is a number then the result will be “true” or if not a number then the result will be “false”. It’s very useful while checking that the input value is a number or not.

2. ParseFloat()

ParseFloat method used to returns a floating-point number. If the input cannot be parsed parseFloat() a value “NaN”.

Math

Math is JavaScript built-in object and it has methods for mathematical constants and functions. It has lots of methods, here some examples:

1. Math.ceil()

Math.ceil() method used for rounding up a number to its next largest number. It always takes a higher number than the input number. Ceil() is a static method of Math, so for using it use Math.ceil().

2. Math.round()

Math.round() is different from the math.ceil(). Math.round() returns the nearest integer of the number. It will be a bigger or smaller number. it returns the closest one.

--

--

Numan Ahmed

I’m passionate & creative about web design & development with problem-solving skills.