Javascript basic concepts


what is array?. An array consists of one or more data. Array is a data structure where we can store multiple data.
Now the question that come to your mind why we need array?. If we have single data we can store easily put in a data variable. But If we have more data what we will do? .we will put multiple data one variable ? .No never it is not possible. So we need array .


parseInt() method return the value a integer number.
example: var num = parseInt(10.44)
console.log(num) // 10
note that parseInte() method only working on number.If you pass a string on this method it is always return NAN

Math.min() && Math.max()

Math objects can be used to mathematical terms.
Ther are many method of math object.Math.min() && Math.max() one of them.
You can get minumum number from multiple numbers use Math.min() method.
example: Math.min(0, 150, 30, 20, -8); // returns -8


This function of this method convert to decimal number to integer number.It always returns integer number like parseInt() method
example : Math.floor(10.10)// return 10
even It is 10.99 then it will be returned 10. That means it always returns an integer number.

Array push()

The push method add a new item to the end of the array and it will change the array length.
example : var name = [ ‘rakib’ , ‘jakib’ , ‘riyan’ , ‘kamil’ , ‘jamil’]
console.log(name) // result ‘rakib’ , ‘jakib’ , ‘riyan’ , ‘kamil’ , ‘jamil’ , ‘michel’
console.log(name.length) // 6
see the length has been changing 6 and add a new item to the end.

Array unshift()

it is the same as Array push() just different is add item at the begining of an array and it will change array length and length will increase.
var name = [ ‘rakib’ , ‘jakib’ , ‘riyan’ , ‘kamil’ , ‘jamil’]
name. unshift(‘michel’)
console.log(name) // result ‘michel’, ‘rakib’ , ‘jakib’ , ‘riyan’ , ‘kamil’ , ‘jamil’
see the length has been changing 6 and add a new item to the beginning.

Array Pop()

The pop() method remove the item at the end of array and array length will be decrease.
example :
var fruits = [“Banana”, “Orange”, “Apple”, “Mango”];
console.log(fruits)//”Banana”, “Orange”, “Apple”
console.log(fruits.length) // 2

Array find()

The find() method will send the first array based on the condition of an array. If condition will match it will be return first array or true value. It is doesn’t execute empty array .It doesn’t change orginal array.
const ages = [10,11,12,13,14,15,16,17,18,19,20]
const result = ages.find(age => age === 15)
console.log(result) //15



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