The 10 Most Common Mistakes JavaScript Developers Make

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 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.

Mistake #1: Incorrect references to this

Mistake #2: Thinking there is block-level scope

Mistake #3: Creating memory leaks

Mistake #4: Confusion about equality

Mistake #5: Inefficient DOM manipulation

Mistake #6: Incorrect use of function definitions inside for loops

Mistake #7: Failure to properly leverage prototypal inheritance

Mistake #8: Creating incorrect references to instance methods

Mistake #9: Providing a string as the first argument to setTimeout or setInterval

Mistake #10: Failure to use “strict mode”

Read more…

Happy Scripting 🙂


Open-source JavaScript hosted libraries

I was searching on internet for JavaScript library and I came across very useful link. Here you can find all latest and stable version of open source JavaScript libraries for your development purpose on one place:

Open-source JavaScript hosted libraries

Happy Coding 🙂

JavaScriptSerializer set MaxJsonLength Property

I was working on WCF Service where I need to return large data in JSON format. We are using JavaScriptSerializer to perform operation. But we are facing following issue:

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

While searching, I ended up with following solution:

The default maximum length for MaxJsonLength is 102400 characters.

The value of the MaxJsonLength property applies only to the internal JavaScriptSerializer instance that is used by the asynchronous communication layer to invoke Web services methods. (MSDN: ScriptingJsonSerializationSection.MaxJsonLength Property)

You can set the MaxJsonLength property on your web.config:

<jsonSerialization maxJsonLength=”2147483644″/>

If you are still receiving the error:

As a workaround, you can do the following within code

var serializer = new JavaScriptSerializer();

serializer.MaxJsonLength = Int32.MaxValue;

string jsonresult = serializer.Serialize(rowData);

Happy Coding 🙂

Auto Update Copyright Year using JavaScript

Copy the script code below and paste it into your website where you want your copyright notice to appear.

<script language=”javascript” type=”text/javascript”>

document.write(‘©’ );


document.write(new Date().getFullYear());


Happy Coding 🙂

How to detect browser name and version using javascript or jquery in

 navigator.sayswho = (function () {
 var ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
 if (/trident/i.test(M[1])) {
 tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
 //return 'IE ' + (tem[1] || '');
 return { name: 'IE ', version: (tem[1] || '') };
 if (M[1] === 'Chrome') {
 tem = ua.match(/\bOPR\/(\d+)/);
 //if (tem != null) return 'Opera ' + tem[1];
 if (tem != null) { return { name: 'Opera', version: tem[1] }; }
 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];

 if ((tem = ua.match(/version\/(\d+)/i)) != null) {
 M.splice(1, 1, tem[1]);
 alert('Browser Name: ' + M.join(' and Version # '));
 return M.join(' ');

Copy above code and paste it into notepad and save notepad as .html file. Now open .html file and you will see the result.