JS alert function's counterpart?

What is the rescript counterpart of the alert function of javascript?

There’s nothing built-in but it’s easy to bind as it’s just a global function which takes a single string argument and returns unit. You can find instructions here: Bind to Global JS Values | ReScript Language Manual

@yawaramin gave you a fishing rod, I’ll give you a fish :new_moon_with_face:

module Window = {
  @scope("window") @val
  external alert: string => unit = "alert"
}
Window.alert("Hello world!")
1 Like

Also available in rescript-webapi :wink:

2 Likes