var hello = "Hello world"
console.log(hello)
var number = 5
var numberSquared = 5 * 5
console.log(numberSquared)
print("Getting info...")
data = requests.get("api.example.com/data")
print("Data retrieval complete!")
print(data)
And that makes sense if you're running a program from a Terminal. It isn't that confusing to your user.
"Go get some data from this API. However, I'm not gonna sit here and wait for you because that could take a while and it would freeze my browser"
"Go get some data from this API. I'm going to move on to the next line, BUT once you've got some data back, I want you to do THIS with them"
console.log("Getting some data for you...")
axios.get("api.example.com/data")
.then((response) => {
console.log(response.data)
console.log("All done!")
})
console.log("JS is great!")
- print "Getting some data for you..."
- print "JS is great"
- (once the data is back) print the data and then print "All done!"