This book provides a developer-level introduction along with more advanced and useful features of JavaScript. Coverage includes: JavaScript use with HTML to create dynamic webpages, language concepts including syntax and flow control statementsvariable handling given their loosely typed naturebuilt-in reference types such as object and arrayobject-oriented programingpowerful aspects of function expressionsBrowser Object Model allowing interaction with the browser itselfdetecting the client and its capabilitiesDocument Object Model (DOM) objects available in DOM Level 1how DOM Levels 2 and 3 augmented the DOMevents, legacy support, and how the DOM redefined how events should workenhancing form interactions and working around browser limitationsusing the tag to create on-the-fly graphicsJavaScript API changes in HTML5how browsers handle JavaScript errors and error handlingfeatures of JavaScript used to read and manipulate XML datathe JSON data format as an alternative to XMLAjax techniques including the use of XMLHttpRequest object and CORScomplex patterns including function currying, partial function application, and dynamic functionsoffline detection and storing data on the client machinetechniques for JavaScript in an enterprise environment for better maintainability
This book is aimed at three groups of readers: Experienced object-oriented programming developers looking to learn JavaScript as it relates to traditional OO languages such as Java and C++; Web application developers attempting to enhance site usability; novice JavaScript developers.
Nicholas C. Zakas worked with the Web for over a decade. He has worked on corporate intranet applications used by some of the largest companies in the world and large-scale consumer websites such as MyYahoo! and the Yahoo! homepage. He regularly gives talks at companies and conferences regarding front-end best practices and new technology.
......(更多)
作者简介:
Nicholas C. Zakas(尼古拉斯•泽卡斯)世界顶级Web技术专家,现为雅虎公司界面呈现架构师,负责My Yahoo!和雅虎首页等大访问量站点的设计。尼古拉斯拥有丰富的Web开发和界面设计经验,曾经参与许多世界级大公司的Web解决方案开发。他还是High Performance JavaScript一书的作者,并与他人合作撰写了Professional Ajax和Even Faster Web Sites。尼古拉斯拥有梅里马克学院计算机科学学士学位和埃迪柯特学院的MBA学位。他的个人网站是www.nczonline.net,他的Twitter别名是@slicknet。
......(更多)
......(更多)
最常见方式,就是组合使用构造函数模式与原型模式,其中构造函数模式用于定义实例属性,而原型模式用于定义方法和共享的属性。结果,每个实例都会有自己的一份实例属性的副本,但又同时共享着对方法的引用,最大限度地节省了内存。另外,这种混成模式还支持向构造函数传递参数……下面的代码重写了前面的例子。可以说,这是用来定义引用类型的一种默认模式
按位非操作符由一个波浪线(~)表示,执行按位非的结果就是返回数值的反码。按位非是 ECMAScript 操作符中少数几个与二进制计算有关的操作符之一。
虽然这两种调用都没有问题,但由于传递字符串可能导致性能损失,因此不建议以字符串作为第一个参数。
......(更多)