The premise behind a template language is that the language is "embedded" within some other master document. Specifically, on your average document, the total size of the document is mostly document source than template language.
Some template languages are full blown general purpose languages, such as PHP, ASP.NET, and Java's JSP. Others are more limited designed specifically for templating, such as Velocity and FreeMarker (both utilities for Java).
Many word processors, such as Microsoft Word, have their own templating capabilities, commonly referred to as "Mail Merge".
1. they do not bind their own values of this 2. Arrow functions are always anonymous. 即function foo(){} 3. Arrow functions are part of the ECMAscript 6 specification, but not part of "normal" JavaScript in use in most browsers today. in place of expressions like function (foo) {...}, you can see below: 例1
var a =["We're up all night 'til the sun","We're up all night to get some","We're up all night for good fun","We're up all night to get lucky"];// These two assignments are equivalent:// Old-school:var a2 = a.map(function(s){returns.length });// ECMAscript 6 using arrow functionsvar a3 = a.map(s => s.length );// both a2 and a3 will be equal to [31, 30, 31, 31]
例2
functionFoo(){this.name = name;this.count =0;this.startCounting();}Foo.prototype.startCounting =function(){var self =this;
setInterval(function(){// this is the Window, not Foo {}, as you might expect
console.log(this);// [object Window]// that's why we reassign this to self before setInterval()
console.log(self.count);
self.count++;},1000)}newFoo();
Once preventDefault has been called it will remain in effect throughout the remainder of the event’s propagation. 意思就是說一旦 call 了preventDefault,在之後傳遞下去的事件裡面也會有效果。
event.stopPropagation():stops the move upwards, but on the current element all other handlers will run. event.stopImmediatePropagation():stop the bubbling and prevent handlers on the current element from running.