Understanding undefined in Javascript

Understanding undefined in Javascript Interesting thing about variable handling in Javascript is there is no type information associated to a variable. Ex, var anoop=1; Here variable anoop is of number type. But, since Javascript has loose typing so we can associate anoop variable to string type. anoop="hello javascript"; What I wanted to say is in Javascript variable can be associated ... Read More »

Number primitive type in Javascript

Number primitive type in Javascript As with any other language Javascript comes loaded with its primitive types. As per ECMAscript5 Javascript has number primitive type for dealing with integers, floating-points, double, long. Well these are some fantasies of JAVA world(which depends on the precision of the number you want), but almost every language has these characteristics. Javascript don’t care about ... Read More »

jQuery load/parse JSON response

jQuery load/parse JSON response jQuery.parseJSON( json ); Takes a well-formed JSON string and returns the resulting JavaScript value, probably object or array of objects. Passing in a malformed JSON string results in a JavaScript exception being thrown. For example, the following are all invalid JSON strings: “{test: 1}” (test does not have double quotes around it). “{‘test’: 1}” (‘test’ is ... Read More »

Javascript for loop vs jQuery for each

Javascript for loop vs jQuery for each Web developers often come across looping through data at client side. People generally use native Javascript coding for loop, or jQuery for each. Javascript For Loop. Example var names= ["anoop", "kumar", "rai"]; var i; var text=""; for (i = 0; i < cars.length; i++) { text += names[i] + ","; } document.write(text); Result-> ... Read More »

Some useful JSP Expression Language hacks in JSP


Some useful JSP Expression Language hacks in JSP If you have JSTL in your classpath(by including JSTL.jar and standard.jar in your classpath), then you need to write below taglib directive so that you can use JSTL tags. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%/> 1. Redirecting to other resource in application <c:redirect url="/hello.html"/> where, hello.html is another resource. 2. Looping model data in ... Read More »

Some useful Regular Expression examples


Some useful Regular Expression examples Regular expression is a special sequence of characters that helps you match/find strings or sets of strings. Basically it defines a search pattern for strings. They can be used to search, edit, or manipulate text and data. The abbreviation for regular expression is regex Below are some useful regex patterns that can be used in ... Read More »