The "Use strict" directive "use strict" is added in JavaScript 1.8.5 (ECMASCRIPT5). It is not a statement, but it is a literal expression that is ignored in older versions of JavaScript. The purpose of the "use strict" is to specify that the code
This article is reproduced, the author put a picture under the original text, said that the reprint needs to charge, and can open a pay treasure of the page, charge 0.99 yuan reprint fee, fun, I posted over,
IntroducedECMAscript 5 added "strict mode", which will make JavaScript run under stricter conditions, the purpose of setting up "strict mode", mainly has the following several:
Eliminate some unreasonable and unreasonable JavaScript grammar,
1 Preface
The rigorous model introduced in ECMASCRIPT5 allows the developer to have a "better" JavaScript language by allowing JavaScript to run the environment to make and present different processes for the most common and difficult bugs in the
Several issues to be aware of in JavaScriptJavaScript is a weak language, she does not use a very cumbersome memory management, type definition and so on, so the learning JavaScript threshold is relatively low. Low threshold does not mean that the
JavaScript Learning record day6-function variable scope, deconstruction assignment and method@ (learning) [JavaScript][TOC]1. ScopeIn JavaScript, variables that are var declared are actually scoped.If a variable is declared inside the function body,
In the previous "JavaScript promises mode-pretty cool callback Hell Terminator" we introduced the promise pattern of JavaScript, and then we used JavaScript promise in our code.JavaScript Promise Library QTried to use Q before, but did not succeed.
First, Objective 1, eliminate some unreasonable JavaScript grammar, not rigorous places, reduce some strange behavior; 2, to eliminate the code to run some unsafe, to ensure the security of code operation, 3, improve the efficiency of the compiler,
To understand it according to the location of this, the situation can be divided into 3 kinds:
1, in the function: this is usually an implied parameter.
2, outside the function (in the top-level scope): In the browser this refers to the global
This can be understood based on the location of this:
1. In a function: this is usually an implicit parameter.
2. Out-of-function (top-level scope): in the browser, this refers to a global object, and in Node. js, it refers to the module Export
Using FastclickNima use is too simple, a straight sentence:Fastclick.attach (document.body);So all the click response speed directly increased, just! What input gets the focus of the problem also solved!!! If you really can, the original change page
Now we use Firefox's latest version 13.0 for testing. If you do not work, the image will automatically return to its original position.
Install the firebug extension and debug it.
Click Enable in the console window,
The error message is:
Window.
JavaScript specification for front-end coding style specifications and front-end javascriptJavaScript specification global namespace pollution and IIFE
Always wrap the code into an IIFE (Immediately-Invoked Function Expression) to create an
ECMAScript version 5 is currently the most widely used version of JS.One of the important feature strict mode is that many people are not very clear and understand.What is strict mode?Strict Mdoe is a forced JS interpretation engine that interprets
As your single page application expands, the download time is also getting longer. This is not good for improving the user experience (hint: But the user experience is the reason why we develop a single page application). More code means larger
JavaScript Learning records day7-higher order functions[TOC]1. What is a higher order functionHigher-order functions are called Higher-order function in English. So what is a higher order function?JavaScript functions actually point to a variable.
First, global namespace pollution
Always wrap the code inside an immediate function expression to form a separate module.
Not recommended
var x = ten,
y = m;
Console.log (window.x + ' + window.y ');
Recommended
;(function
This article mainly introduces FlappyPig, a pure javascript-based mini-game, and analyzes in detail the related skills of the javascript-based mini-game FlappyPig, this section describes how to use javascript to perform page element movement,
# The JavaScript authoritative guide notes-part 1thDescription: Printed version: April 2012 1th Edition, September 2016, 17th time printing.The style of the book and "effective Java" very similar, recommended.This note is recorded in reverse order.--
Strict mode (Strict mode) is a new feature of ECMASCRIPT5. ECMAScript5 can be backwards compatible with ECMASCRIPT3, but if you use strict mode, which ECMAScript5 "not recommended" ECMASCRIPT3 syntax feature will be all in the system, if it appears
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.