Skip to content

Dhruvmodi418/Array-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Array-basic

Array basic

  1. Array Access and Identification Initialization: Defines an array arr containing seven numeric elements.

Length Property: Uses .length to output the total number of elements in the array.

Indexing: Accesses a specific element using bracket notation (arr[2]), which retrieves the third item (23).

  1. Transformation and Formatting String Conversion: Uses .toString() to convert the array into a comma-separated string.

Custom Joins: Uses .join(" and ") to create a single string where the elements are separated by the word "and" instead of commas.

  1. Sorting and Multiple Arrays Sorting: Applies the .sort() method to a2. Note that for the mixed data types in a2, the sort converts elements to strings and orders them lexicographically.

Empty Arrays: Initializes an empty array a3, representing a container ready for future data.

About

Array basic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors