Javascript for Basic Programming

Today I will tell you guys about the javascript, soo.. what is javascript?

Javascript is one of many programming languages. it designed to run at client side and make our web pages alive, but nowadays there’s some javascript platform that can run at server side.

For more information about javascript in details, you can read Here.

So let’s begin with simple one,

First, create a new HTML file.



Then add event function on the button, like this
<button onclick=”count()”>Count!</button>

this onclick=” count()” will call count function on javascript that having some script to count the values of a triangle.

then next is type


function count(){

var b = document.getElementById(“b”).value;

var h =  document.getElementById(“h”).value;

var c = (b*h)/2;





var b is a declaration from variable b that having the value from the element on our pages which having “b” to be it id.

console.log(c) is showing us the result from a formula on the console. There’s many ways to show the result like put it on alert, or just put it on another element at our web pages.



Also, there are many events on javascript, like onchange, onkeyup, onload etc. You can check event list here Javascript Event List



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s