fetch('http://example.com/message.json') .then(function(response) { return response.json(); }) .then(function(data){ console.log("print message:", data); }); console.log("second line will show up first");