作者:LennyBurdette 页数:312 出版社:empty |
In the seventh grade, Lenny Burdette checked out the book Teach YourselfHTML in 24 Hours from the public library, and the rest, as they say, ishistory 5ince graduating from UCLA, Burdette has worked at5chematicin LosAngeles, California, where he is the reigning Guitar Hero champl on.5chematicfhttp://www.schematc.com}isadigitalmarkingagencythat has given him opportunities to develop JavaScript for Websites,e-commerce platforms, TV, and mobile.AcknowledgmentsId first like to thank Cliff Colby and Bruce Hyslop for the opportunity towrite this book as well the faith that I could.Huge thanks goto editorKim Wimps ett and the rest of the team at Peachpit Press for making theprocess ga more smoothly than lever imagined it would.Adam Luik arts feedback and sharp eye were invaluable throughout thewriting process.All of my colleagues at5chematic, especially RichardHerrera and the rest of I EG, area wealth of inspiration and supportAdditionally, Nick Rodriguez and Dan Duvall were incredibly gracious tolook over my work; low n them both many beersI wouldn't be where lam without all the teachers Ive had through mylife, from Mrs.Rhea all the way to Casey Re as.Much thanks to Mr.Fairchildespec all, since it was in his dass where my love of the Web beganAnd of course, thanks to my family, Mom, Dad, Julie, and Rachel, for theirlove and supportContentsIntroduction, xv liWhy JavaScript Is Coolxvii lWho Should Read This Book cx cixWhat You Need to Follow AlongxixWhat'sin This BookxixWhat's Not in This BookXDLResourcesxxWriting Java5cript CodexxiCase Sensitivityx cxiCommentsxxiSemicolonsxxiiWhitespace and NewLinesxxd ifReserved Words, xx ciiBalanced Brackets and Quotesx odvFirebugx oct vChapter i:JavaScript BasicsExpressions and Statements.2Variables and DataValuesComparisonTruthiness and Fal siness..6Functions and Objects8ObjectsLoopsControl Flow.f/ifelse/elseswitch/casetry/catch/finallythrowbreak and continueCompound Expressions.Boolean OperatorsLogical NOTLa gical AND·&&Logical OR:ⅡCombining Boolean OperatorsTernary Express tons..Chapter z:NumbersBasic MathNumber FormatsConstants and FunctionsThe Math ObjectEven More Properties and MethodsGenerating Random Integers.Conversion,Number Precisionchapter3:StringsEscape CharactersOperators
Between email application 5, sa cial networking sites, online word proces-sors, and mobile Web browsers, the Internet is becoming more usefuland more powerful everyday.Alot of that powercom nes from Java Seri pt,a quirky little language available on nearly every computer in the worldthrough browsers such as InternetExplorer, Fire fax, Safari, Opera, andChrome.Brendan Eich created the language for the Netscape browserint 995.naming it after Java eventhough the languages have onlysuperficial similarities.Its formal name is ECMAScript.governed by theEuropean Computer Manufacturers Association(ECMA) which publishedthe fifth edition of the language in December 20og
The Java Scr pt Pocket GuideJavaScript is a scripting Jan guage, meaning it gives you the ability tocontrol an environment with code.In the case of Java5cript, the environ-mentis usually a Webpage in a browser, where you can react to themouseandkeyboard,createandanimateelementsonthepage.commu-nicate with servers, and much more,Why JavaScript Is CoolThe following are the reasons whyJava5criptiscool-or atleast why lthink its cool:.Low barrier to entry.Anyone can start wit ing and te sing JavaScriptcode with software they already have on their computer.m Easy of deployment.All you need to include JavaScript on your Website is a server to store the code files and the e script tag.Small language, big power.The language has a relatively smallnumber of features, but its flexibilty and expressiveness lets youaccomplish a great deal.m The quirkiness.JavaScript has alot of little oddities and flaws thatI find fascinating It seems like l learn a new nuance to the languageevery week.Some nuances are even usefull·The language of the moment.JavaScript is becoming more im partant and more powerful as our lives are increasingly impacted by theInte met.The community.Im continually amazed at the brilliance and in genu-ity of the JavaScript community, mast of whom release their code foranyone to use for freeWho Should Read This BookYou'I need a solid foundation of HTML and css because there's littleroom to explain either of those languages in this book.lde ally.you'veseen JavaScript before; maybe you've even copied some code from anonline tutorial into your blog.If youre coming from a different program-ming background, Tll brie tly touch on the factors that make JavaScriptfairly unique among popular languages todayWhat You Need to Follow AlongYou need a texteditor to write JavaScript files, ideally one with syntaxhighlighting such as Nate pada for Windows ar TextWrangler for MacOSxf both free} .Also, because of security restrictions in Web browsers, youwll need a server to try the Ajax examples, either running on ya ur owncomputer or running on the Web.XAMPP(http://www.apochefriends.org/en/xampp html] is ago ad program to get a server running quickly on yourown computerWhat'sin This BookThe first half of this book(Chapters i-8) begins with some basicsfollowed by explanations of the fundamental parts of the language.Youwan't learn too many practical uses of lava Script until the second half(Chapters g-17.which covers programming Webpages and containsin-depth tutorials for a variety of tasks.Throughout the chapters andcode examples, l emphasize the important concepts more than theminute details.
Contents
Introduction, xv li
Why JavaScript Is Coolxvii l
Who Should Read This Book cx cix
What You Need to Follow Alongxix
What'sin This Bookxix
What's Not in This BookXDL
Resourcesxx
Writing Java5cript Codexxi
Case Sensitivityx cxi
Commentsxxi
Semicolonsxxii
Whitespace and NewLinesxxd if
Reserved Words, xx cii
Balanced Brackets and Quotesx odv
Firebugx oct v
Chapter i:JavaScript Basics
Expressions and Statements.2
Variables and Data
Values
Comparison
Truthiness and Fal siness..6
Functions and Objects8
Objects
Loops
Control Flow.
f/ifelse/else
switch/case
try/catch/finally
throw
break and continue
Compound Expressions.
Boolean Operators
Logical NOT
La gical AND·&&
Logical OR:Ⅱ
Combining Boolean Operators
Ternary Express tons..
Chapter z:Numbers
Basic Math
Number Formats
Constants and Functions
The Math Object
Even More Properties and Methods
Generating Random Integers.
Conversion,
Number Precision
chapter3:Strings
Escape Characters
Operators
Properties
Meth ads
.............