Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

JavaScript

JavaScript is a Type-less scripting language used windely in the web programming world.

JavaScript 005 – One Dimensional Array

JavaScript Array and Index

You can notice that each cell is indexed, and the index start from zero. To access, 2nd person in the Array, we will use the index operator with the array name. For example, Persons[1] refers to the second element in the array called Persons. In the above code, we added person 4 to the array using the statement Persons[3] = “Person 4”. That statement will create a new cell at index location 3 and stores the new person’s name.

Continue Reading →

JavaScript 004 – parseInt & NaN

JavaScript parseInt

In JavaScript, a variable can hold any data type. Sometimes, we need to convert the string representation of a number to an integer or float. For example, data submitted by web form comes in string format, even user entered the data in number format. We can say an age submitted by the user comes as a string. JavaScript, need to convert this as a number. Once data is converted to a number, it can involve in mathematical expressions

Continue Reading →

JavaScript 003 – Document Object

Javascript Write String to document

One can retrieve the loaded html document in JavaScript using its document object. Here, in this example, we will form a String and show that in the document using the JavaScript document object. Note, we can learn more about document object in future examples.

In this JavaScript Example, we will create dynamic string by asking the user input. Then, via Javascript document object we will display it.

Continue Reading →