Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVASCRIPT


  Strict mode in JavaScript

1. IntroductionIn addition to normal mode, ECMAScript 5 includes the other mode : strict mode. It means it will make JavaScript codes execute in a more strict environment.The purposes to have strict mode are:Remove some unreasonable and parts of JavaScript syntax. Reduce some of the quirk behaviors.Remove some insecure parts of code execution. Make the execution environment more secureImprove interpret efficiency and increase the execution speedBuild foundation for future JavaScript versionStrict mode shows that JavaScript is moving toward more reasonable and more secure. Most of the mainstrea...

3,901 0       JAVASCRIPT STRICT MODE. INTRODUCTION


  An easy way to log client side information to server

JavaScript debug is a very troublesome thing in web application development. Because many web browsers will not notify you if there is any error in the JavaScript codes you write. They just silently fail and block the following codes execution. In order to debug JavaScript codes, we need a good log mechanism which will help us log the error information,, we often need to log errors in JavaScript codes to server for debug purpose in a production web application,What should we do?The first thought comes into our mind may be using AJAX, since it involves client server communication and we al...

4,785 0       IMAGE DEBUG JAVASCRIPT LOG AJAX


  Accurate floating point number calculation in JavaScript

In JavaScript, since floating point is defined with IEEE754,there will be some accuracy issues while doing floating point number arithmetic. Here is a function which can resolve the accuracy issue.var calc = function(num1,operator,num2,len){    var numFixs = function(num){        var arr = num.toFixed(len).toString().split('.');        return parseInt(arr.join(''));    }    switch(operator){        case '+':          &nbs...

6,136 0       JAVASCRIPT FLOATING POINT IEEE 754 ACCURACY


  4 asynchronous programming methods in JavaScript

You may know the execution environment of JavaScript is single threaded. The so called single thread means only one task can be running at any time, if there are many tasks, they need to be in a queue and wait for the previous task to be completed.The advantage of this mode is it's easy to implement and the execution environment is relative simple; the disadvantage is that if one task takes long time, the tasks following it must wait in the queue and this will delay other tasks consequently. The end result is the browser may hang.To solve this issue, JavaScript divides the task execution modes...

10,758 0       JAVASCRIPT ASYNCHRONOUS PROGRAMMING EVENT MODEL PROMISE


  10 design flaws of JavaScript

JavaScript's design took only ten days. Moreover, the designer didn't want to design it initially, he just wanted to complete the task assigned by company. It is now a very powerful client side programming language used in almost all the websites. It's an excellent language, but it also has some flaws.1. Not suitable for large projectsJavaScript doesn't have namespace, it's hard to be modular, there is no standard for putting codes in multiple source files. It allows defining functions with the same name, the function defined later will override the one defined previously, it's hard for method...

17,996 4       JAVASCRIPT DESIGN FLAW OBJECT


  About browser event

First look at following codes:var $ = KISSY.all;$(‘a’).on(‘click’,function(e){doSomeThing();//This function seems very famouse.halt();});The above codes seem complete the work we want them. The browser will not redirect us to the link in href, but is there some issue with the codes above?Before explaining what's wrong with the above codes, we first need to understand some concepts.Browser default behaviorWhen we click a link, the browser will redirect us to another link; when pressing ENTER key, the form will submit automatically. These are the default behavior of brows...

2,721 0       JAVASCRIPT EVENT EVENT BUBBLING EVENT CAPTURING


  How to choose a jQuery plug-in?

jQuery plug-in provides a good way to save time and simplify the development, programmers don't need to write each component from scratch. However, the plug-in will also be a destabilizing factor in your code library. A plug-in saves countless development time, but a poor quality plug-in will cost more than the actual time to write your own component from scratch.Luckily, usually you have many pls to choose from, but even if you have only one plug-in, you also need to know whether it's worth using or not, don't ever introduce wrong codes into your code library.Do you need a plug-in?First you n...

3,440 0       JQUERY PLUG-IN


  Free jQuery UI themes

jQuery UI is a jQuery User Interface library, it provides many frequently used components and functions. It consists of datepicker, slider, progress bar and drag and drop support etc.Also it has many themes, you can use ThemeRoller to customize your own theme. But with ThemeRoller, we can still find the shadow of jQuery UI.If you want some highly customized, free and high quality jQuery themes such as Bootstrap, Windows-Metro, then the following themes may suit you.1. jQuery UI BootstrapjQuery UI Bootstrap is a jQuery UI theme, it is encouraged by Twitter's Bootstrap, it introduces slickness i...

15,827 0       JQUERY UI THEME