For example:
function mf(z, x c, lol = b) { // I need lol = azazaz
let b = azazaz
...
}
Instead of lol = azazaz
I obviously get b is not defined
.
What I can do:
function mf(z, x, c, lol = "b") { //parameter lol is a string
let b = azazaz
lol = eval(lol) //now lol = azazaz
...
}
Also I can do this:
function mf(z, x, c, lol) { //parameter lol doesn't have default value
b = azazaz
if (lol == 0) {
lol = b //default value of lol = azazaz
}
...
}
But the first one looks so non-professional, the second one has extra if statement which I also don't want. Is there any better way to do this?
function mf(z, x c, lol = 'azazaz')
or when you call it likemf(z, x c, 'azazaz')
?