Javascript arguments vs named parameters

// different behavior in ES5 non-strict vs ES5 strict and ES6

function go(id, name = "jack") {
name = "bill";

// the values of the variables (2, "bill")

// the actual values passed in (1, "john")
// but in ES5 non-strict, they are linked to the named ones, so (2, "jack")

go(1, "john");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s