Usually I see default value of a function to be a "static" or "constant" value and is not generated by another function call.
Example of what I mean:
function test(num = 10) {
// code ...
}
I have the following example. Is this ok or bad design?
function test(num = randomNumber()) {
// code ...
}
Alternative would be like this.
function test(num) {
if (num === undefined) {
num = randomNumber()
}
// code ...
}