Skip to main content

JavaScript Question 148

Question 148 of 0JavaScript

What's the output?

Login Required

Please login to select answers and solve this question. You can view the question without logging in.

Code:
const user = {
	email: "e@mail.com",
	password: "12345"
}

const updateUser = ({ email, password }) => {
	if (email) {
		Object.assign(user, { email })
	}
	if (password) {
		user.password = password
	}
	return user
}

const updatedUser = updateUser({ email: "new@email.com" })

console.log(updatedUser === user)

Select the correct option: