Which array types cannot be sorted Array of integers Array o

Which array types cannot be sorted?

Array of integers

Array of Strings

Array of objects

You can sort all of these array types

Array of integers

Array of Strings

Array of objects

You can sort all of these array types

Solution

You can sort all of the above array types.

1. An array of integers is sorted in increasing or decreasing order of the numbers.

Ex: 1 2 3 4........... (or) 5, 4, 2, -1........

2. An array of strings is sorted according to the first letter of the string.

Ex: apple, high, ink, man, monk................

3. An array of objects is sorted based on one of the properties of the object.

Ex:

var employees=[]

employees[0]={name:\"George\", age:32, retiredate:\"March 12, 2014\"}

employees[1]={name:\"Edward\", age:17, retiredate:\"June 2, 2023\"}

employees[2]={name:\"Christine\", age:58, retiredate:\"December 20, 2036\"}

employees[3]={name:\"Sarah\", age:62, retiredate:\"April 30, 2020\"}

This array of employees can be sorted based on name (or) age (or) retiredate.

  

Which array types cannot be sorted? Array of integers Array of Strings Array of objects You can sort all of these array types Array of integers Array of Strings

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site