scala.js

Scala.js - How to show browser alert?


How to show a browser alert window in Scala.js? JavaScript version is as follows:

alert()
alert(message)

Solution

  • Using scala-js-dom:

    import org.scalajs.dom.window.alert
    
    alert("Hello Scala.js")