I want to create a function with default params, but I want to use one default param and then use a custom value for the following one. For instance,
function greet(name, greeting = 'Hey', question = 'How are you?') {
console.log(`${greeting}, ${name}! ${question}`);
}
greet('Jack', , 'You good?'); // tried this, doesn't work :(
What if I wanted to say, "Hey, Jack! You good?", where I use the default for the first param with a default value, but not the second? I have tried calling the function with nothing between the commas in the function call. Is there a way to do this in JS without explicitly passing 'Hey', the defined default value, to the param that has a default already assigned?