Mode entretien. Minuteur de 3 min, sans indices ni autocomplétion
JSON there and back
FacileJSON 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.
Exemples
jsonRoundTrip({ name: 'John', age: 35 })Renvoie { json: '{"name":"John","age":35}', copy: { name: 'John', age: 35 } }
Chargement de l'éditeur...
- Entrée
jsonRoundTrip({ name: 'John', age: 35 })Attendu{ json: '{"name":"John","age":35}', copy: { name: 'John', age: 35 } } - copy equals user, but it is a different object
Les tests cachés se lancent à la soumission