38. Javascript Arrays - Full stack web development Course

WB Web Development Solutions
WB Web Development Solutions
18.6 هزار بار بازدید - 6 سال پیش - In this FullStackWebDevelopment tutorial series
In this FullStackWebDevelopment tutorial series video, We will learn about #javascript #arrays and #methods .

An array is a special variable, which can hold more than one value at a time. An array can hold many values under a single name, and we can access the values by referring to an index number.

In JavaScript, array is a single variable that is used to store different elements. It is often used when we want to store a list of elements and access them by a single variable. Unlike most languages where array is a reference to the multiple variable, in JavaScript array is a single variable that stores multiple elements.

Syntax: var array_name = [item1, item2, ...];

We can access an array element by referring to the index number. Array indexes start with 0.[0] is the first element. [1] is the second element and so on.

- The push() method is used to add new items to the end of an array, and returns the new length. The new item(s) will be added at the end of the array. Also this method changes the length of the array. To add items at the beginning of an array, use the unshift() method.
Syntax:  array.push(item1, item2, ..., itemX)

- The indexOf() method Javascript array indexOf() is an inbuilt function that returns the first index at which the given item can be found in an array, or -1 if it is not present in an array. Javascript indexOf() method searches the array for a specified item and returns its position to the calling function.
If we want to search from end to start, use the lastIndexOf() method

- Array.splice(position,num); The position argument specifies the position of the first item to delete and the num argument determines the number of elements to delete. The splice() method changes the original array and returns an array that contains the deleted elements.

----------------------------

Week 1 : Day 7
Section 5 : Learning to Code With Javascript
Tutorial 38:  Javascript Arrays

----------------------------
Do subscribe and hit Bell Icon
----------------------------

Follow us in social media handles for opportunities and code related support.

Instagram: Instagram: wb.web
Facebook: Facebook: wbweb
Twitter: Twitter: wbweb_in
LinkedIn: LinkedIn: wbweb

----------------------------------------------------------

Got a question on the topic? Please share it in the comment section below and our experts will answer it for you.

For more information, please write back to us at [email protected] or call us at IND: 7077568998

After completing the course, write to [email protected] for internship or freelancing opportunities.

For consultation or partnership related queries drop a mail to [email protected].
6 سال پیش در تاریخ 1397/03/05 منتشر شده است.
18,652 بـار بازدید شده
... بیشتر