Modo entrevista. Cronômetro de 3 min, sem dicas e sem autocompletar
First object
FácilObjects3 min
Write a function editUser(user) that gets a user object.
Add the property surname with the value 'Smith', change name to 'Pete' and delete the property age. Leave the other properties as they are. Return the same object.
Exemplos
editUser({ name: 'John', age: 30 })Retorna { name: 'Pete', surname: 'Smith' }
editUser({ name: 'Ann', city: 'Oslo' })Retorna { name: 'Pete', city: 'Oslo', surname: 'Smith' }
Carregando o editor...
- Entrada
editUser({ name: 'John', age: 30 })Esperado{ name: 'Pete', surname: 'Smith' } - Entrada
editUser({ name: 'Ann', city: 'Oslo' })Esperado{ name: 'Pete', city: 'Oslo', surname: 'Smith' } - Returns the same object
Os testes ocultos rodam no envio