Hello pnaik!
It's well worth reading this: How do I post a question effectively? :)
You should always have "use strict" and "use warning" near the start of your script (except in trivial scripts). They'll save you a lot of time catching bugs at compile time.