DEV Community

Discussion on: Why I LOVE CoffeeScript!(and why you should use it)

Collapse
 
aminnairi profile image
Amin

What sold me was the way top-level await is handled. Deno has this. Stil missing in Node.js and the browser and it saddens me a lot.

endpoint =
  "https://jsonplaceholder.typicode.com/users"

options =
  method: "GET"
  mode: "cors"
  credentials: "include"
  headers:
    "Content-Type": "application/json"
    "Accept": "application/json"

do ->
  try
    response = await fetch endpoint, options
    users = await response.json()
    console.log users

  catch error
    console.error error.message
Enter fullscreen mode Exit fullscreen mode