In PHP we can specify default value of variable in function like:
function myFunction(myDefaultVariable, myOtherVariable, myCheckVariable = "basic"){
// so yeah, myDefaultVariable is required always,
// same applies for myOtherVariable,
// and myCheckVariable can be skipped in function call, because it has a default value already specified.
}
Is there something similar to this in JavaScript?
You don’t need to pass all the variables in Javascript.
Although a less hacky way would be to use objects:
To call it: