then(sampleJson => console.log(ssage)) console.log("Hello!") Īs we can see in ruby, firstly the data from the URL is fetched, and then the message property value “Not Found” is displayed and after that the static message saying “Hey! Let us have a look at message.” is displayed while in case of JavaScript, firstly the request for getting the URL data is sent and JavaScript does not wait till the response comes, instead it executes the second statement displaying “Hello” on console and when the response of the sent request arrives, it displays the message value saying “Not Found”. then(sampleResponse => sampleResponse.json()) Where “Not Found” is the message string stored in the issues section on the mentioned github url. Puts "Hey!Let us have a look on message." SampleResponse = JSON.parse(Net::HTTP.get(sampleUri)) puts sampleResponse
SampleUrl = '' sampleUri = URI(sampleUrl)