I've seen an example giving wrong output when I try to run it. I don't understand why I get the wrong result while it is supplied in order. At the last call, I expect a=7, b=10
. What's wrong?
"use strict";
function f(a=1, b=2){ return(`a=${a}, b=${b}`) }
f() // a=1, b=2
f(a=5) // a=5, b=2
f(a=7, b=10) // a=7, b=10
f(b=10, a=7) // Order is required: a=10, b=7