What is javascript array?

Array is the an indexing base storage area, he can store multiple value in the single variable.


Array have a lot of pre built medhods as: push(), pop(), shift(), unshift(), concat(), slice(), splice(), join(), toString(), map(), copyWithin(), reverse(), forEach(), Array.isArray(), sort(), indexOf(), lastIndexOf(), find(), findIndex(), filter(), entries(), every(), fill(), flat(), flatMap(), Array.from(), includes(), keys(), Array.of(), reduce(), reduceRight(), some(), toLocaleString(), toSource(), values() etc.


Array syntax:

var arrayName = ["array vaule1", "array vaule2", "array value3", "array value more"];

Javascript Array example:

<p id="test"></p>
<p id="test1"></p>

<script>
var color = new Array( "Black", " Blue", " Red" );
document.getElementById("test").innerHTML = color;

var colorNew = ["New Black", " Blue", " Red"];
document.getElementById("test1").innerHTML = colorNew;
</script>





No comments:

Note: Only a member of this blog may post a comment.

Copyright Reserved to Anything Learn. Powered by Blogger.