Skip to content

devleague/Challenge-Matrix-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matrix Generator

Write an function that takes 2 inputs:

  1. Number of rows
  2. Number of columns

Your function should do the following:

  1. Generate a multi-dimensional array with the specified number of rows and columns in the array populated with random numbers between 1 and 100.
  2. Sorts the array with natural numeric sorting. You will need to use/write/find a sort function as your argument to the JavaScript Array.sort() method for numbers to be sorted as numeric values.
  3. Returns the sorted multi-dimensional array

Ex. generator(3, 3)

Output: [[1, 2 ,3], [4,5,6], [7,8,9]]

Stretch Goal

Sort the inner arrays so that the first index is in order.

Example (before stretch):
[[2,3,4], [1,5,6], [7,8,9]]

Output (after stretch):
[[1,5,6], [2,3,4], [7,8,9]]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published