Posts

Showing posts from September, 2022

Arrays, Function and String in JavaScript

  Arrays Array is an ordered collection of the elements which stores the data. Syntax: There are 2 syntaxes for creating an empty array:                 let   arr = [];                 let arr = new Array();  Ex Mostly the first syntax is used to create an array,  We can initialize values as follows: let   fruits = [“Pineapple”, ”Mango”, ”Watermelon”]; Array elements are ordered and starts with index 0 (zero) We can access array elements by its numbers                 let   fruits = [“Pineapple”, ”Mango”, ”Watermelon”];                 document.write(fruits[0]);             ...