Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book offers a detailed explanation of the features that make JavaScript an outstanding object-oriented programming language, and warns you about the bad parts.
In the process, JavaScript: The Good Parts defines a subset of JavaScript that's more reliable, readable, and maintainable than the language as a whole. Author Douglas Crockford, a member of JavaScript 2.0 committee at ECMA, is considered by many people in the development community to be the JavaScript expert.
A beautiful, elegant, lightweight and highly expressive language lies buried under a steaming pile of good intentions and blunders, he explains. The very good ideas include functions, loose typing, dynamic objects, and an expressive object literal notation. Awful ideas include a programming model based on global variables. With JavaScript: The Good Parts, you can release this elegant programming language from its old shell, and create more maintainable, extensible, and efficient code.
The book's topics include:
* Syntax
* Objects
* Functions
* Inheritance
* Arrays
* Regular expressions
* Methods
* Style
* Beautiful features
Appendices summarize JavaScript's bad parts and awful parts. But the greatest benefit of studying the good parts is that you can avoid the need to unlearn the bad parts. If you want to learn more about the bad parts and how to use them badly, consult any other JavaScript book.
JavaScript is the language of the Web -- the only language found in all browsers -- so avoiding it altogether is not an alternative. But, whether you're managing object libraries or just trying to get Ajax to run fast, Crockford's guidance in JavaScript: The Good Parts will help you create truly effective JavaScript code.
Douglas Crockford is a Senior JavaScript Architect at Yahoo!. He is the maintainer of the JSON format, and a regular speaker at conferences on advanced JavaScript topic. He is also on the JavaScript 2.0 committee at ECMA.
Weallfindthegoodpartsintheproductsthatweuse.Wevaluesimplicity,andwhensimplicityisn’tofferedtous,wemakeitourselves.Mymicrowaveovenhastonsoffeatures,buttheonlyonesIusearecookandtheclock.Andsettingtheclockisastruggle.Wecopewiththecomplexityoffeature-drivendesignbyfindingandstickingwiththegoodparts.Itwouldbeniceifproductsandprogramminglanguagesweredesignedtohaveonlygoodparts.
——引自第100页
不像许多其他语言,JavaScript中的代码块不会创建一个新的作用域,因此变量应该被定义在函数的顶端,而不是在代码块中。
——引自第10页
精彩摘录Grown-upslovefigures.Whenyoutellthemthatyouhavemadeanewfriend,theyneveraskyo...
你不可不知的法律常识 本书特色 酒后出事,同席者承担多大责任?样品误当新品卖,是否构成消费欺诈?车借给朋友出了事故,责任由谁承担?是不是合同都可以采用电子签名?...
考古人的日常工作是怎样的?常常灰头土脸,偶尔惊天动地。搞调查勘探的时候经常会有老乡觉得我们形迹可疑。时间一长,队员们干脆编了顺口溜自我调侃:“远看像逃难的,近看...
疲劳断裂可靠性工程学 内容简介 本书在前人工作的基础上,汇集作者在疲劳断裂可靠性工程学方面的研究成果,按学科体系纂辑而成。全书总体构思如下:作者将材料疲劳断裂性...
结构可靠性分析与随机优化设计的统一方法 本书特色 李洪双、马远卓的《结构可靠性分析与随机优化 设计的统一方法》围绕结构可靠性分析和结构优化设 计对精确、高效方法...
史书停止的地方,小说就开始了。短篇小说集《太平鬼记》的故事原型取材于《左传》《史记》《汉书》,富有中国史上那个英雄时代的气质,还蒙上了一层奇古的神秘色彩。这样一...
约翰·赫尔(John C.Hull),现任职加拿大多伦多大学罗特曼管理学院,曾执教约克大学、纽约大学、英国伦敦商学院等高校。在衍生品以及风险管理领域享有盛誉,曾...
传记作家纪云裳、邢超联袂打造,一本深情满满且又引人深思的李商隐传记。以义山诗词为主线,集生平传记及其诗作鉴赏为一体,参考多种书目,深度还原一个真实、立体的李商隐...
宋春涛:从事管理培训、人力资本咨询超过10年,先后服务过安利、雅芳、IBM、中国民生银行等众多国际和本土知名企业, 曾为100多家企业、3000多名学员进行过演...
基础材料力学 内容简介 本书旨在从理论源头来认识《材料力学》这一基础理学分支。在学科公理化、基本理论物理基础、强度理论的认识和材料实验原理和方法方面有新探索。本...
★内容介绍纳粹军官妻子、犹太女人,这两个看似截然对立的称呼却在本书中紧紧地捆绑在一个人身上。不为别的,只是一个女人为了尽力存活下去。伊迪丝·汉恩是在奥地利快乐成...
Philip K. Dick:粉丝昵称PKD。美国科幻文学界的传奇人物,在美国科幻黄金时代独树一帜。共出版44部长篇小说和121个短篇小说,曾获雨果奖和坎贝尔奖...
知名心理学家李松蔚倾情作序推荐樊登读书会收听收看量破1300万40年长销不衰的原生家庭经典著作一个人或许无法突破“原生家庭”,但一家人可以重新定义心理治疗,颠覆...
作品目录导言《旧制度与大革命》影响史资料 前言 第一编 第一章 大革命爆发之际,人们对它的评论歧异 第二章 大革命的根本与最终
细说中国法律典故 内容简介 本书共收录中国历代法律典故二百三十一条。时间跨度自先秦至清末。根据内容的不同,全书分为六编,即:法律术语典故、司法典故、案例典故、刑...
妇科六大病证中医药治疗 内容简介 本书分别附述了部分常见现代医学疾病的中医药治疗,每一病证分概述、辨证论治、临证心语、验案选录四部分,并附有笔者临床常用的验方和...
精对苯二甲酸(PTA) 内容简介 本书主要内容包括:PTA现货和期货基本知识、PTA价格影响因素、PTA上游企业如何利用PTA期货、PTA生产企业和贸易商如何利...
福建土楼探源 本书特色 《福建土楼探源》收录了福建土楼起源时间考;福建土楼起源地点考;福建土楼(南靖)文化考;福建土楼起源功用考;怀远楼匾额解释及文化特色;太平...
骆一禾,诗人,诗歌批评家。1961年2月6日生于北京。小时候随父母下放河南农村。1979年考入北京大学中文系,1983年毕业后到《十月》杂志社担任编辑工作。19...
精彩摘录Similarly,aclosedsetFisconnectedifonecannotwriteF=F1∪F2whereF1andF2aredisjoi...