JavaScript function declaration syntax: var fn = function() {} vs function fn() {}

JavaScript function declaration syntax: var fn = function() {} vs function fn() {} In Javascript there are 2 ways to create functions:- function declaration:- function fn(){ console.log("Hello"); } fn(); This is very basic, self-explanatory, used in many languages and standard across C family of languages. We declared a function defined it and executed it by calling it. What you should ... Read More »

forEach method in Arrays – Functional Programming in Javascript Part 3

forEach method in Arrays – Functional Programming in Javascript Part 3 In Javascript arrays are objects. It has a method forEach(fn) that takes function as argument and executes it for each element of the array. This function can have element of the array, index and array itself as argument. var myArray=[10, 20, "Hello", {}]; var myFunction=function(item, index, array){ console.log("For an ... Read More »

JAVA/XML based configuration of DWR 3 with Spring MVC 4 and annotations

JAVA/XML based configuration of DWR 3 with Spring MVC 4 and annotations This post is for people who know working of DWR(Direct Web Remoting) with Spring MVC. In order to understand DWR and kindly follow below post. http://jkoder.com/direct-web-remoting/ Having understood DWR, let’s configure DWR with Spring MVC version 4 . In this post I will show configurations based on XML ... Read More »

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

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. function hello(){ //some code } 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 ... Read More »

git .gitignore not working

If we come across a situation when we feels that the .gitignore file is not working then you are required to run these below commands- git rm -rf --cached . This removes any changed files from the staging area, then run the below command- git add . After running these above commands, now run the commit command and see the ... Read More »

Secrets of Javascript Arrays

Secrets of Javascript Arrays Arrays are a common structure in many languages, Its a sequence of values that you wanna access in an indexed based way. Let’s define an array. var myArray=[100,200,300]; A point to note that Javascript arrays are zero based(well ofcourse nothing new!). But what’s the secret. Let’s raise the curtains. What if I say to calculate the ... Read More »

type coercion and === operator in 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

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 »