Tag Archives: javascript

typeof operator- typeof null-a known bug in javascript

typeof operator- typeof null-a known bug in javascript As per ECMAscript5 specifications Javascript has 5 primitive data-types. number string boolean undefined null We all know that Javascript is loosely typed, a Javascript variable holding a particular type of value can hold another type of value at another point of time. So, interrogating Javascript variables and values is a very handy ... Read More »

Difference between undefined and null in Javascript- When to use what?

Difference between undefined and null in Javascript- When to use what? This is one of the most confusing topics in the Javascript world. Beginners finds it difficult to understand when to use what. Kindly read my below post for understanding undefined. Understanding undefined in Javascript Null is like N/A(not applicable). It’s a non-value, nothing. Both undefined and null indicates absence ... Read More »

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 »

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 »

jQuery detecting scroll- scroll reaching to the bottom of page

jQuery detecting scroll- scroll reaching to the bottom of page Detecting scroll and executing login based on scrolling has important significance in web development like implementing pagination, where more data gets loaded when user scrolls near the bottom of page. So, first basic question arises as to how to detect scroll. window.onscroll = function(ev) { //execute your logic here } ... Read More »

Using strict mode to write secure Javascript

Using strict mode to write secure Javascript We know that doing read operation from undeclared variable gives error in Javascript, whereas doing write operation to an undeclared variable is fine and the variable gets the global scope (I will discuss this in a different post as to why this happens in Javascript). Now, lets take stock of a situation in ... Read More »