Home > JavaScript (page 2)

JavaScript

Function expression and Anonymous Function expression – Functional Programming in Javascript Part 1

javascript

Function expression and Anonymous Function expression – Functional Programming in Javascript Part 1 Most of us know how to create a function using function declaration in javascript. To execute above function we just need to call the function by writing hello(). What if I say that javascript provides flexibility in creating functions using another approach called function expression. Remember, functions ... Read More »

Secrets of Javascript Arrays

javascript

Secrets of Javascript Arrays Arrays are a common structure in many languages, It’s a sequence of values that you wanna access in an indexed-based way. Let’s define an array. A point to note that Javascript arrays are zero-based (well of course nothing new!). But what’s the secret. Let’s raise the curtains. What if I say to calculate the length of ... Read More »

type coercion and === operator in javascript

javascript

type coercion and === operator in javascript Type coercion is where you have variables declared & assigned to a value and you are operating on those variables. There are certain points of time where the interpreter will have to do automatic type conversions to equivalent value of the other operands type for you in order to make operations work. Type ... Read More »

typeof operator- typeof null-a known bug in javascript

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?

javascript

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

javascript

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

Number primitive type in Javascript

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 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 using single quotes ... Read More »