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

 ALL


  Understand JavaScript prototype

For an front end programming language like JavaScript, if we want to understand its OOP feature, we need to understand its objects, prototype chain, execution context, closure and this keyword in deep. If you have a good understanding on these concepts, you should be confident that you can handle this language well.The inheritance in JavaScript is not class inheritance like Java, but it adopts another mechanism-- prototype inheritance. The key to prototype inheritance is the prototype chain mechanism which realizes one of the most important feature of OOP--inheritance.In this article, we will ...

3,202 0       JAVASCRIPT PROTOTYPE __PROTO__


  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,904 0       JAVASCRIPT STRICT MODE. INTRODUCTION


  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,138 0       JAVASCRIPT FLOATING POINT IEEE 754 ACCURACY


  HTML5 Web Worker

Web Worker is a JavaScript multithreading solution provided by HTML5. we can put some compute intensive codes into Web Worker and it will not hang the user interface.1. How to use Web WorkerWeb Worker's basic mechanism is to use Worker to load a JavaScript file to create a new thread in JavaScript's main thread. It will not block other thread's execution and will provide a data exchange interface between main thread and new thread : postMessage() and onmessage.Let's look at an example://worker.jsonmessage =function (evt){ var d = evt.data;//Get sent data with evt.data postMessage( d );//Send...

9,309 0       JAVASCRIPT HTML WEB WORKER


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

18,002 4       JAVASCRIPT DESIGN FLAW OBJECT


  Firefox 18 will adopt IonMonkey as its JS compiler

Tendency would be converse after 30 years. The previous famous Firefox is now forced to change its version number frequently becuase of the rise of Chrome. Last month Mozilla released Firefox 15 and  also released news about Firefox 17, And now Firefox 18 is also ready to come out.According to PCWorld, to keep the promise of bring quicker and smoother experience, Mozzila will adopts new JavaScript technology in Firefox 18. The new Firefox with new JavaScript technology will be 26% quicker than Firefox 17. If we take Google Chrome's v8 engine as a benchmark, then Firefox will be 7% qu...

3,576 0       JAVASCRIPT FIREFOX 18 IONMONKEY


  Some hidden XSS injection vulnerabilities

XSS injection refers to a Web page generates some unexpected executable js codes based on user input  and these executable codes are executed by web browser,i.e, the source code sent to web browser by the server contains some illegal js codes, and these illegal js codes are related to user's input.Common XSS injection vulnerabilities can be fixed with some functions such as htmlspecialchars(escaping HTML special characters) and strip_tags() or similar, but there are some hidden XSS injection vulnerabilities can not be fixed by the two functions above, and sometimes we are not allowed to r...

7,705 0       PHP SECURITY XSS JAVASCRIPT CODE


  Google open sources Leak Finder for JavaScript

Google recently open sourced a tools for finding memory leaks in JavaScript programs.In JavaScript you cannot have "memory leaks" in the traditional sense, but you can have objects which are unintentionally kept alive and which in turn keep alive other objects, e.g., large parts of DOM.Leak Finder for JavaScript works against the Developer tools remote inspecting protocol of Chrome, retrieves heap snapshots, and detects objects which are "memory leaks" according to a given leak definition.The default configuration of the tool detects goog.Disposable objects which were not dispose()d. goog.Even...

4,691 0       JAVASCRIPT GOOGLE OPEN SOURCE