Walkthrough with null and undefined in JavaScript

In this article I will try to explain about the null and undefined in JavaScript. We will discuss the difference and uses of both.

Basically undefined is the type in the JavaScript. undefined value is returned when you use an object property that does not exist, or a variable that has been declared without assigning any value. It is not a reserved keyword so you can write a undefined as method or variable name. See the following code. Continue reading “Walkthrough with null and undefined in JavaScript”

JavaScript Introduction

– JavaScript is an interpreted, object-based scripting language.

– JavaScript is the client side script(The script that is executed client-side, by the user’s web browser)

– JavaScript is a prototype-based scripting language(Prototype-based programming is a form of OOPS in which inheritance is performed through a process of cloning existing objects that serve as prototypes.) with dynamic typing.

– JavaScript is organized into statements, blocks consisting of related sets of statements.

– JavaScript also allows the comments like other programming languages.

Example

<!DOCTYPE html>
<html>
<head>
<script>
function CallFunction()
{
alert("Hello World!");
}
</script>
</head>
  <body>
    <button onclick="CallFunction()">Click  Here</button>
  </body>
 </html>

You can see the JavaScript code in the script code. When the user will click on the button ‘Click here’ the JavaScript code will be executed.

<script>
function CallFunction()
{
alert("Hello World!");
}
</script>

You can run the program by copy all code and paste in the text file and save with chapter1.html. After the save the file just open in any browser and click on the button.

In the next Chapter, we will start with the declaring variables and use the statements.