How to return a value outside its function?

let array = [];

function getCheckboxes(checkbox) {
	let addRandomCheckbox = new RandomAdd(checkbox);
	array.push(addRandomCheckbox);
	return array;
}

let getValue = getCheckboxes();
console.log(getValue); // returns nothing

This returns nothing…but if I do console.log(array) inside the function; there are some value inside the array.

To add to randall’s answer…

The reason arra has a value when you print it is because it is a global variable so it is getting modified inside getCheckBoxes.

You were right…was a small mistake from my side.