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 shoppingList = ["catfish", "water", "tulips", "blue paint"]
    shoppingList[1] = "bottle of water"
    var occupations= {Malcolm: 'Captain',Kaylee:'Mechanic'}
    occupations["Jayne"] = "Public Relations"
    
    alert(shoppingList)
    alert(shoppingList[1])
    alert(JSON.stringify(occupations))
}