Logo


Arrays in javascript


In this article we will learn about arrays in javascript and its methods. Array is data structure which contains data of same data types. We will learn in detail in another chapter about methods of array in javascript.


Below is the common methods of array in javascript.


1const arr = ['x', 'y', 'z','a'];
2console.log(arr.length) // 4;
3// Getting an Array element
4console.log(arr[1]) // x;
5// Setting an Array element
6arr[1] = 'n';
7// Adding an element to an Array:
8arr.push('d');
9console.log(arr); //['x', 'y', 'z','a'] 

About

Moiz is a software engineer from Arid University with a passion for writing tech tutorials and doing coding. I am continously produce JavaScript and other web development technology tutorials in concepts through easy-to-understand explanations written in plain English.I have expertise in next js ,react js ,javascript,html,bootstrap and node js.

Follow him on Twitter

Hassan is a software engineer from kohat university of science and technology with a passion for writing tech tutorials and doing javascript practices on daily basis.I have expertise in next js ,react js ,javascript,html,bootstrap and node js. Problem Solving and making concpets is my strong point.

Follow him on Twitter

Tags

Click to see all tutorials tagged with:

© Copyright 2023 Pak Annonymous | Back To Homepage | Privacy Policy
Share