I have a function that returns an array with data. Then I create a variable to hold the object. And I pass a function call to one of the keys. I need to get the length of the array before calling the function and pass it to the key. How can i do this?
const arrFunc = () => {
let result = [];
//add value to array
return result;
};
let result = {
length: //here I need to display the number (the length of the "result" array)
array: arrFunc(),
};
console.log(result);