Tech Rocks


An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Monday, June 19, 2017

Buggy JavaScript Code

Today, JavaScript is at the core of virtually all modern web applications. The past several years in particular have witnessed the proliferation of a wide array of powerful JavaScript-based libraries and frameworks for single page application (SPA) development, graphics and animation, and even server-side JavaScript platforms. JavaScript has truly become ubiquitous in the world of web app development and is therefore an increasingly important skill to master.

At first blush, JavaScript may seem quite simple. And indeed, to build basic JavaScript functionality into a web page is a fairly straightforward task for any experienced software developer, even if they’re new to JavaScript. Yet the language is significantly more nuanced, powerful, and complex than one would initially be lead to believe. Indeed, many of JavaScript’s subtleties lead to a number of common problems that keep it from working – 10 of which we discuss here – that are important to be aware of and avoid in one’s quest to become a master JavaScript developer.

  • Common Mistake #1: Incorrect references to this
  • Common Mistake #2: Thinking there is block-level scope
  • Common Mistake #3: Creating memory leaks
  • Common Mistake #4: Confusion about equality
  • Common Mistake #5: Inefficient DOM manipulation
  • Common Mistake #6: Incorrect use of function definitions inside for loops
  • Common Mistake #7: Failure to properly leverage prototypal inheritance
  • Common Mistake #8: Creating incorrect references to instance methods
  • Common Mistake #9: Providing a string as the first argument to setTimeout or setInterval
  • Common Mistake #10: Failure to use “strict mode”

Read more


Post a Comment