JSFiddle - React, Tailwind, and code Playground

by Abid Akhtar

HTML

<h1>
Hello 
</h1>
<h2>
i'm the Level 2 Heading
</h2>
<button>
 Press Me
</button>

JavaScript

function multiply(num1,num2){
 let result = num1 * num2;
  return result;
}

let result = multiply(2,3);

console.log('The result is ' + result);

document.querySelector('h1').onclick = function(){
 alert('Ouch stop pocking me');
}

document.querySelector('h2').onclick = function(){
alert('Pressing me on h2');
}

document.querySelector('button').onclick = function(){
  alert('You clicked me ');
}

let myHeading = document.querySelector('button');

function setUserName(){
 let myName = prompt('Please enter your Name');
 localStorage.setItem('name',myName);
 myHeading.textContent = 'Mozilla is cool ' + myName;
}

setUserName();