function test (foo = 1, bar = 2) { console.log(foo, bar); } test(bar=5); // foo gets overwritten, bar remains default parameter Run code snippetHide results