Table of contents
No headings in the article.
POP():
pop() => method removes last element from the array=>
example- const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop();
PUSH()=>
push method add new element to an array at the end.
example:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
IndexOf()=>
let num=[1,2,3,4,5,6,7,8];
console.log(num.indexOf(6));
include() =>
let num= [1,2,3,4,5,6,7,8];
console.log(num.includes(8,7))
isArray()=>
def: it check is array or Not,
let num = [1,2,3,4,'anurag' , 5,6,7];
console.log(Array.isArray(num));
join() =>
Ex:=> let arr1=[1,2,3,4,5,6];
console.log(arr1.join('And'));
defination :=> It has join charc betn all the element of array and remove array and converted array to something else
lastindexof() =>
def:=> it give last index of Character.
EX:=> let num = [1,2,3,4,5,'anurag',6,'anurag',7,8];
console.log(num.lastIndexOf('anurag'));
map()=>
def=> whatever we right inside the map it applied all element inside the array.
Ex=> let maths=[1,2,4,9,16];
console.log(maths.map(Math.sqrt));
pop()=>
Def=> It has modified orignal array and remove last element.
Ex=> let math=[1,2,3,4,5];
console.log(math.pop());
console.log(math);
output=> 5, [1,2,3,4,]
reverse()=>
def=> it just do reverse the array.
Ex=> let math=[2,34,5,67];
console.log(math.reverse());
shift()=>
def => it pick the first items and remove it and also change the origanl array.
Ex=>let maths=['khan',4,7,6,9];
console.log(maths.shift());
console.log(maths);
sort()=>
Def=> it will sort the array in ascending order.
let math= ['khan' , 'anurag' ,'hitesh','thapa','nareshit'];
console.log(math.sort());
unshift()=>
Def=> it add element in array at first position .
Ex=> let fruits=['apple1', 'chota apple' , 'Bada apple' , 'orange apple'];
fruits.unshift('maaz','santara');
console.log(fruits);
splite()=>
Defination => it will convert to array (string is converted to array)
let name='fuzail';
let array1=name.split('');
console.log(array1);
output=> ['f','u','z','a','i','l']
** for of loop =>
defination => itterate over an array.
Ex=> let fruits = ['apple', 'bada apple' ,'chota apple' ,'king appple'];
let upperfruits=[];
for(let badaletter of fruits){
upperfruits.push(badaletter.toUpperCase());
}
console.log(upperfruits);
output=> [ 'APPLE', 'BADA APPLE', 'CHOTA APPLE', 'KING APPPLE' ]
**Break and continue =>
Def=> Break=>as soon as the value come to 3,the block of whole loop get terminate and it will come out of the block.
Ex =>for (let i=0;i<=5 ; i++){
if(i==3){
break;
}
console.log(i);
}
output => 0 ,1,2
** Continue =>
Def => skip that value