Array basic
- 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).
- 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.
- 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.