JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input type="button" value="Click me!" onclick="window.displaymessage()" />
</form>
<p>By pressing the button above, a function will be called. The function will alert a message.</p>
JavaScript
window.displaymessage= function ()
{
var cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"]
var sortedCities = cities.sort()
indexOfLondon = sortedCities.indexOf("London")+1
alert("London is city number " + indexOfLondon + " in the list")
alert(sortedCities)
}