1 . Prepare new HTML file

<!DOCTYPE html><meta http-equiv=”content-type” charset=”utf-8"><html><head><title>Calculator</title></head><body></body></html>

2 . Write codes in HTML file

  • Add ‘div’ , ‘h1’ , ‘input /’, ‘button’ tags in body
<body><div class=”cal”><h1>CALCULATOR</h1><input /><button>123</button></div></body>
  • Write JS codes in <button>
<input /><button onclick=”document.querySelector( ‘input’ ).value = ‘123’ “>123</button>


Genki Ohara

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store