Java Script:Array - learnit

Home Top Ad

Post Top Ad

Sunday, May 31, 2020

Java Script:Array

Array: Java Script

Java Script:Array

The JavaScript Array class is a global object that is used in the construction of arrays; which are high-level, list-like objects.


Description

Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations. Neither the length of a JavaScript array nor the types of its elements are fixed. Since an array's length can change at any time, and data can be stored at non-contiguous locations in the array, JavaScript arrays are not guaranteed to be dense; this depends on how the programmer chooses to use them. In general, these are convenient characteristics; but if these features are not desirable for your particular use, you might consider using typed arrays.


Arrays cannot use strings as element indexes (as in an associative array) but must use integers. Setting or accessing via non-integers using bracket notation (or dot notation) will not set or retrieve an element from the array list itself, but will set or access a variable associated with that array's object property collection. The array's object properties and list of array elements are separate, and the array's traversal and mutation operations cannot be applied to these named properties.


Constrctor

Array()

      Creates a new Array object.

Static Properties

get Array[@@species]

      The constructor function is used to create derived objects.


Static methods

Array.from()

      Creates a new Array instance from an array-like or alterable object.


Array.isArray()

      Returns true if the argument is an array, or false otherwise.


Instance methods

Array.prototype.at()

      Returns the array item at the given index. Accepts negative integers, which count back from the last item.


Array.prototype.concat()

      Returns a new array that is this array joined with other array(s) and/or value(s).


Array.prototype.copyWithin()

      Copies a sequence of array elements within the array.


Array.prototype.entries()

      Returns a new Array Iterator object that contains the key/value pairs for each index in the array.


Array.prototype.every()

      Returns true if every element in this array satisfies the testing function.


Array.prototype.fill()

      Fills all the elements of an array from a start index to an end index with a static value.


Array.prototype.find()

      Returns a new array containing all elements of the calling array for which the provided filtering function returns true.


Array.prototype.findIndex()

      Returns the found index in the array, if an element in the array satisfies the testing function, or -1 if not found.


Array.prototype.forEach()

      Calls a function for each element in the array


Array.prototype.includes()

      Determines whether the array contains a value, returning true or false as appropriate


Array.prototype.indexOf()

      Returns the first (least) index of an element within the array equal to an element, or -1 if none is found.


Syntax

<html>
<head>
<title> </title>
</head>
<body >
<?php
Var array[value1,value2,value3,….];
…………
?>
</body>
</html>

Example1

<html>
<head>
<title> Java Script: Array </title>
</head>
<body>
<p id="array">
<?php
var ii=["Hello", "My", "Name","Is"];
document.getElementById("array").innerHTML=ii;
?>
</body>
</html>


Array Methods
Arrays provide a lot of methods. to make things easier, in the chapter they are split into groups.

Example

<html>
<head>
<title> Java Script: Array </title>
</head>
<body>
<p id="array">
<?php
var ii=["Hello", "My", "Name","Is"];
document.getElementById("array").innerHTML=ii.toString();
?>
</body>
</html>

Please Watching My Video is Below

No comments:

Post a Comment

Post Top Ad