Modo entrevista. Temporizador de 3 min, sin pistas y sin autocompletado
JSON there and back
FácilJSON and data3 min
Write a function jsonRoundTrip(user). It turns the object user into a JSON string and then parses that string back into a new object. Return { json, copy } with the string and the object made from it.
Ejemplos
jsonRoundTrip({ name: 'John', age: 35 })Devuelve { json: '{"name":"John","age":35}', copy: { name: 'John', age: 35 } }
Cargando el editor…
- Entrada
jsonRoundTrip({ name: 'John', age: 35 })Esperado{ json: '{"name":"John","age":35}', copy: { name: 'John', age: 35 } } - copy equals user, but it is a different object
Las pruebas ocultas se ejecutan al enviar