The parseInt() and parseFloat() are commonly used functions in JavaScript to parse the string into number according to your needs. The parseFloat() function parses a string and returns an a floating point number. Continue reading “String to Number Conversion in JavaScript”
Tag: JavaScript Tutorial
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”
Check whether variable is defined or not in JavaScript
Remember, undefined is an object in JavaScript. To determine if a variable or object property exists, It is good to compare to keyword undefined
or you can also check the type of the object to string ‘undefined’. Continue reading “Check whether variable is defined or not in JavaScript”
Data types in JavaScript
In this article we will discuss the different datatypes of the JavaScript. We have discuss about the Variables in the JavaScript in the last chapter.
Basically JavaScript recognizes the following types of values: Continue reading “Data types in JavaScript”
Declaring Variables in JavaScript
In the last chapter we have discussed about the JavaScript introduction. This chapter demonstrates the about the declaring Variables in JavaScript. Continue reading “Declaring Variables 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.