Coming from Python, I'm used to defining default params like this:
def someFunc(defarg1=0, defarg2=10, defarg3="Hello", defarg4=100):
Then I can use it like so:
someFunc(defarg3="Goodbye")
In Javascript, I understand you can do the same in the definition:
someFunc(defarg1=0, defarg2=10, defarg3="Hello", defarg4=100) {}
But when I want to call the function and only change, say, defarg3, I can't do that since each argument is converted to positional arguments and their names are ditched. So doing this in Javascript doesn't work:
someFunc(defarg3="Goodbye");
From what I understand, I need to pass every other argument before defarg3. And since I don't want to change the default args before it, I have to supply the same default value:
someFunc(0, 10, "Goodbye");
Perhaps I'm missing something, but this seems incredibly redundant and prone to making mistakes. What if a function has a whole lot of default args and I just want to change one. There has to be a way instead of redundantly supplying the same default argument for previous args every time.