The response is not the body; json() must be called.
Acceptance criteria
- 1.#out should show Ada.
The response is not the body; json() must be called.
function fetch(url) { return Promise.resolve({ ok: true, json: function () { return Promise.resolve({ name: "Ada" }); } }); } fetch("/api/user").then(function (response) { document.querySelector('#out').textContent = response.name === undefined ? "the response has no name" : response.name; });
Output ready when you are
Press Run to render your code, or Submit to validate your solution.