Welcome Guest! (App Version 3.1)

websitnero logo name

My First Program in JavaScript

My First Program in JavaScript

JavaScript is pretty easy language if you know the basics. JavaScript basically is used to bring user interaction and enhance user experience. Also, most of the logical work can be shifted from backend to front end thereby releasing the valuable resource usage from backend server to client computer, ie, on the browser.

JavaScript first program refers to show an alert on click of a button picking up whatever is fed as input in an input box. There is a button that we create with the help of HTML as an element. We add an event onclick on it and create a function in JavaScript which grabs the text in input box and alerts whatever text is written in the input box. Functions are at the core of JavaScript. Most of the work is done in JavaScript with help of functions only. For any task you make functions and they do the task like automatic machine. You will be surprised to know that complete jQuery Library is nothing but collection of lots of functions, where you just pass parameters and they do the task for you.


<input type="text" id="input1">
<button onclick="alpha()"> Click </button>

function alpha(){
  var a = document.getElementById('input1').value;
  alert("The message is: " + a);
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.