работа с массивом в function JS

Если не сложно объясните на пальцах, почему function не принимает (и конвертирует) массив в undefind. Заранее благодарю.

let rundomCount = Math.floor(Math.random() * 10) + 1;
let firstArray = [];
let doubleValue = [];
for (i = 0; i < rundomCount; i++) {                
  firstArray[i] = Math.floor(Math.random() * 10);
  firstArray.push(firstArray[i]);
}
alert(firstArray);

function sortArray(firstArray) {
  alert(firstArray); 
}
sortArray();

Ответы (0 шт):