JavaScript Absolute Beginner's Guide by... | WHSmith Books
JavaScript Absolute Beginner's Guide

JavaScript Absolute Beginner's Guide

By: Kirupa Chinnathambi (author)Paperback

Only 1 in stock

£11.99 RRP £23.99  You save £12.00 (50%) & FREE Saver Delivery on orders over £20


JavaScript Absolute Beginner's GuideNo experience necessary!Make the most of JavaScript -- even if you've never programmed anything before. This book is the fastest way to learn JavaScript and use it together with CSS3 and HTML5 to create powerful web and mobile experiences. Learn how to do what you want, the way you want, one incredibly easy step at a time. JavaScript has never been this simple!This is the easiest, most practical beginner's guide to programming JavaScript with simple, reliable instructions for doing everything you really want to do! Here's a small sample of what you'll learn:Learn why JavaScript is awesomeOrganize your code with variablesUnderstand how functions make your code reusableUse the popular if/else statement to help make a decision in codeLearn about switch statements and when to use themWork with for, while, and do...while loopsLearn how to use global and local scope Understand what closures are Learn about the various places your code can live Understand how to write comments and good commenting practicesLearn about the basic types of objects you'll run into in JavaScriptFind out that pizza has an educational value beyond just being deliciously awesomeUnderstand how text is treated in JavaScript Learn how to perform common string operationsUse arrays to handle lists of dataLearn to create custom objectsPurchase of JavaScript Absolute Beginner's Guide in any format includes free access to the online Web Edition, which provides several special features to help you learn:The complete text of the book onlineShort videos by the author introducing each chapterInteractive quizzes to test your understanding of the materialUpdates and corrections as they become availableThis Web Edition can be viewed on all types of computers and mobile devices with any modern web browser that supports HTML5.Contents at a Glance 1 Hello, World!Part I: The Basic Stuff2 Values and Variables3 Functions4 Conditional Statements: If, Else, and Switch5 Meet the Loops: For, While, and Do...While!6 Timers7 Variable Scope8 Closures9 Where Should Your Code Live?10 Commenting Your CodePart II: It's an Object-Oriented World11 Of Pizza, Types, Primitives, and Objects12 Strings13 When Primitives Behave Like Objects14 Arrays15 Numbers16 A Deeper Look at Objects17 Extending Built-in Objects18 Booleans and the Stricter === and !== Operators19 Null and Undefined20 Immediately Invoked Function ExpressionsPart III: Working with the DOM21 JS, The Browser, and The DOM22 Finding Elements in the DOM23 Modifying DOM Elements24 Styling Your Content25 Traversing the DOM26 Creating and Removing DOM Elements27 In-Browser Developer ToolsPart IV: Dealing with Events28 Events29 Event Bubbling and Capturing30 Mouse Events31 Keyboard Events32 Page Load Events and Other Stuff33 Handling Events for Multiple Elements34 Conclusion

About Author

Kirupa Chinnathambi has spent most of his life trying to teach others to love web development as much as he does. In 1999, before blogging was even a word, he started posting tutorials on In the years since then, he has written hundreds of articles, written a few books (none as good as this one, of course!), and recorded a bunch of videos you can find on YouTube. When he isn't writing or talking about web development, he spends his waking hours helping make the Web more awesome as a Program Manager in Microsoft. In his non-waking hours, he is probably sleeping...or writing about himself in the third person.


Introduction 1Parlez-vous JavaScript? 2Contacting Me/Getting Help 4Chapter 1 Hello, World! 5What Is JavaScript? 7A Simple Example 8Code Editing Tools 8The HTML Document 9Looking at the Code: Statements and Functions 10PART I: THE BASIC STUFFChapter 2 Values and Variables 13Using Variables 14More Variable Stuff 15Naming Variables 15More on Declaring and Initializing Variables 16Chapter 3 Functions 19What Is a Function? 22A Simple Function 22Creating a Function That Takes Arguments 24Creating a Function That Returns Data 27The Return Keyword 27Exiting the Function Early 28Chapter 4 Conditional Statements: If, Else, and Switch 31The If/Else Statement 32Meet the Conditional Operators 34Creating More Complex Expressions 36Variations on the If/Else Statement 38Phew 39Switch Statements 39Using a Switch Statement 39Similarity to an If/Else Statement 42Deciding Which to Use 44Chapter 5 Meet the Loops: For, While, and Do...While! 47The for Loop 49The Starting Condition 51Terminating Condition (aka Are we done yet?) 51Reaching the End 51Putting It All Together 52Some for Loop Examples 52Stopping a Loop Early 53Skipping an Iteration 53Going Backwards 54You Don't Have to Use Numbers 54Array! Array! Array! 54Oh No He Didn't! 55The Other Loops 55The while Loop 56The do...while Loop 56Chapter 6 Timers 59Meet the Three Timers 60Delaying with setTimeout 60Looping with setInterval 61Animating Smoothly with requestAnimationFrame 62Chapter 7 Variable Scope 67Global Scope 68Local Scope 70Miscellaneous Scoping Shenanigans 71Declarations Using var Do Not Support Block Scoping 71How JavaScript Processes Variables 72Closures 74Chapter 8 Closures 77Functions within Functions 78When the Inner Functions Aren't Self-Contained 81Chapter 9 Where Should Your Code Live? 89The Options on the Table 90Approach #1: All the Code Lives in Your HTML Document 92Approach #2: The Code Lives in a Separate File 93The JavaScript File 93Referencing the JavaScript File 94So Which Approach to Use? 97Yes, My Code Will Be Used on Multiple Documents! 97No, My Code Is Used Only Once, on a Single HTML Document! 99Chapter 10 Commenting Your Code 101What Are Comments? 102Single Line Comments 103Multi-line Comments 104Commenting Best Practices 106PART II: IT'S AN OBJECT-ORIENTED WORLDChapter 11 Of Pizza, Types, Primitives, and Objects 109Let's First Talk About Pizza 110From Pizza to JavaScript 113What Are Objects? 115The Predefined Objects Roaming Around 117Chapter 12 Strings 121The Basics 122String Properties and Methods 124Accessing Individual Characters 124Combining (aka Concatenating) Strings 125Making Substrings out of Strings 126Splitting a String/split 128Finding Something Inside a String 129Upper and Lower Casing Strings 130Chapter 13 When Primitives Behave Like Objects 133Strings Aren't the Only Problem 134Let's Pick on Strings Anyway 134Why This Matters 137Chapter 14 Arrays 139Creating an Array 140Accessing Array Values 141Adding Items to Your Array 143Removing Items from the Array 145Finding Items in the Array 146Merging Arrays 147Chapter 15 Numbers 149Using a Number 150Operators 151Doing Simple Math 151Incrementing and Decrementing 152Special Values-Infinity and NaN 153Infinity 153NaN 154The Math Object 154The Constants 155Rounding Numbers 157Trigonometric Functions 158Powers and Square Roots 158Getting the Absolute Value 159Random Numbers 59Chapter 16 A Deeper Look at Objects 161Meet the Object 162Creating Objects 163Specifying Properties 167Creating Custom Objects 169The this Keyword 175Chapter 17 Extending Built-in Objects 179Say Hello to Prototype...Again-Sort of! 181Extending Built-in Objects Is Controversial 185You Don't Control the Built-in Object's Future 186Some Functionality Should Not Be Extended or Overridden 186Chapter 18 Booleans and the Stricter === and !== Operators 189The Boolean Object 190The Boolean Function 190Strict Equality and Inequality Operators 192Chapter 19 Null and Undefined 195Null 196Undefined 197Chapter 20 Immediately Invoked Function Expressions 201Writing a Simple IIFE 203Writing an IIFE That Takes Arguments 204When to Use an IIFE 205Avoiding Code Collisions 206Closures and Locking in State207Making Things Private 213PART III: WORKING WITH THE DOMChapter 21 JS, The Browser, and The DOM 219What HTML, CSS, and JavaScript Do 220HTML Defines the Structure 220Prettify My World, CSS! 222It's JavaScript Time! 223Meet the Document Object Model 225The Window Object 227The Document Object 228Chapter 22 Finding Elements in the DOM 231Meet the querySelector Family 232querySelector 233querySelectorAll 233It Really Is the CSS Selector Syntax 234Chapter 23 Modifying DOM Elements 237DOM Elements Are Objects-Sort of! 238Let's Actually Modify DOM Elements 240Changing an Element's Text Value 242Attribute Values 242Chapter 24 Styling Your Content 247Why Would You Set Styles Using JavaScript? 248A Tale of Two Styling Approaches 248Setting the Style Directly 249Adding and Removing Classes Using classList 250Adding Class Values 250Removing Class Values 251Toggling Class Values 251Checking Whether a Class Value Exists 252Going Further 252Chapter 25 Traversing the DOM 255Finding Your Way Around 256Dealing with Siblings and Parents 259Let's Have Some Kids!259Putting It All Together 261Checking Whether a Child Exists 261Accessing All the Child Elements 261Walking the DOM 262Chapter 26 Creating and Removing DOM Elements 265Creating Elements 266Removing Elements 271Cloning Elements 273Chapter 27 In-Browser Developer Tools 279Meet the Developer Tools 280Inspecting the DOM 282Debugging JavaScript 287Meet the Console 293Inspecting Objects 294Logging Messages 296PART IV: DEALING WITH EVENTSChapter 28 Events 299What Are Events? 300Events and JavaScript 3021. Listening for Events 3022. Reacting to Events 304A Simple Example 305The Event Arguments and the Event Type 307Chapter 29 Event Bubbling and Capturing 311Event Goes Down Event Goes Up 312Meet the Phases 316Who Cares? 319Event, Interrupted 319Chapter 30 Mouse Events 325Meet the Mouse Events 326Clicking Once and Clicking Twice 326Mousing Over and Mousing Out 328The Very Click-like Mousing Down and Mousing Up Events 330The Event Heard Again...and Again...and Again! 331The Context Menu 332The MouseEvent Properties 333The Global Mouse Position 333The Mouse Position Inside the Browser 334Detecting Which Button Was Clicked 335Dealing with the Mouse Wheel 336Chapter 31 Keyboard Events 339Meet the Keyboard Events 340Using These Events 341The Keyboard Event Properties 342Some Examples 343Checking That a Particular Key Was Pressed 343Doing Something When the Arrow Keys Are Pressed 344Detecting Multiple Key Presses 345Chapter 32 Page Load Events and Other Stuff 349The Things That Happen During Page Load 350Stage Numero Uno 351Stage Numero Dos 352Stage Numero Three 352The DOMContentLoaded and load Events 353Scripts and Their Location in the DOM 355Script Elements-Async and Defer 358async 358defer 359Chapter 33 Handling Events for Multiple Elements 363How to Do All of This 365A Terrible Solution 366A Good Solution 367Putting It All Together 370Chapter 34 Conclusion 373Glossary 377Index 381

Product Details

  • ISBN13: 9780789758064
  • Format: Paperback
  • Number Of Pages: 416
  • ID: 9780789758064
  • weight: 520
  • ISBN10: 0789758067

Delivery Information

  • Saver Delivery: Yes
  • 1st Class Delivery: Yes
  • Courier Delivery: Yes
  • Store Delivery: Yes

Prices are for internet purchases only. Prices and availability in WHSmith Stores may vary significantly