Programming Examples

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

Web

Web Programming (Font-End, Back-End)

JavaScript 002 – Calculation via Expression

JavaScript Expression Evaluation

In JavaScript, you can perform arithmetic by forming the expressions. When making the expression, you can use binary operators like addition (+), subtraction (-), multiplication (*) and division (/). We call them as a Binary Operator as it operates on two variants. Now look at the expression below:

10 – 4 * 2

You may expect the result is 12. But the result is 2. Because here Operator Precedence comes into picture. The operator * and / play higher priority than the + and – operators. In the above expression, the binary operation * is figured out on the operands 4, 2. Then the binary operation minus is done on the operand 10 and 8 giving up the result as 2. In the above expression, we used only the constant values. But one can use the variables also as an operand.

Continue Reading →

JavaScript 001 – Declare Variable

First Java Script - Declare Variable

In JavaScript, you can declare a variable using the var keyword. This tells the system to reserve some memory for future use. After declaring the variable, we can store a value in it. For example:

var MyVar;
Myvar = 12;

In the above snippet, we declare a variable called MyVar using the keyword var. In the next line, we store a value of 12 into the variable MyVar. The = sign denotes the assignment. Means. It tells value 12 is assigned to the variable MyVar. Note, JavaScript is case sensitive and when you read the back the value you have to use the same variable name with the same case.

Continue Reading →

HTML5 Table – Rowspan, Colspan

Html5 Rowspan ColSpan Example Output

In Html5,

tag will present the data as rows and columns. Suppose a table is having 5 rows and three columns, then the

tag contains five rows of data, with each row having 3 cells of data. In html,

represents a Table Row which will be placed inside the
tag. Each Table row may have one or more Table Data and Html represents it as

. In this example, we will see how to create a simple Html Table and then we will study Rowspan and Colspan attributes.

Continue Reading →

HTML5 List – Ordered , Unordered & Definition

Html5 Nested List Example

Html5 supports three kinds of lists. They are: Ordered List, UnOrdered List, Definition List. Ordered List contains sequence numbers. So, when you want to provide a list item in which order is important, you can use the ordered list. In the Unordered List, the sequence of items is not needed, and browser renders these items as bulleted points. In Html5, Definition Lists are to provide terms & its definitions.

Continue Reading →