Monday, July 28, 2014

Learn the Underscore.js | Day 0

Hi,

So here we are going to have a series of post focusing on the underscore.js. The content will be to the point and in simple words.If you have any questions or queries do leave the comments and I will take care of them.

For the Day 0 we will start with following:
1) What is underscore.js
2) Features of underscore,js
3) How to Install Underscore.js



What is underscore?
Underscore is JS framework and it is not just another framework .It is the framework made to play with data and lot of data, manipulate data, sorting , filtering , loops, arrays, objects and a lot more. (data in terms of JSON, API, XML), built in functions, helpers, objects and many more.

Official site of Underscore.js - http://underscorejs.org/

Why to use Underscore?
  • -          One framework can take care of your lot of Data (JSON, API etc.)
  • -          Write less , do more
  • -          Very effective for SPA
  • -          JS templates
  • -          Built in functions, built in objects, helpers etc.
  • -          Can be used with jQuery
  • -          Plug and user
  • -          Improvement in performance


How to Install?

Download the underscore.js from their official site and link it to your HTML page and you are good to go.



happy coding !!

Javascript Return False

What the hell is "Return False" and what it do

Many times in our code we have used Return false and also somewhere in the same code we have use the event.preventDefault and event.stopPropogation.

But did we ever give a minute to think about what is return false is doing?

Yes, it is cancelling the default behavior but then what is event.preventDefault?

Are we just doing come copy paste and not following the  standards?

So, what is return false is - as we have said that yes it cancel the default behavior of browser but it also have one more event in it which is stopProgation() which for sure we might not needed in many places but just by using return false without any requirement we are also calling stopPropgation()

We should avoid using return false and start using the preventDefault and stopPropogation.

Below is the useful link for same  http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/


Happy Coding!!

Sunday, July 27, 2014

Java script code Refactoring

As an front-end Developer we work a lot in JS. When it comes to re factoring the code below is the good online book for some key points to be taken care:

http://javascriptplayground.com/the-refactoring-tales/refactoring-tales.html


Happy Coding!!