• Complain

John Resig - Secrets of the JavaScript Ninja

Here you can read online John Resig - Secrets of the JavaScript Ninja full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2016, publisher: Manning Publications, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

John Resig Secrets of the JavaScript Ninja

Secrets of the JavaScript Ninja: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Secrets of the JavaScript Ninja" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Summary

More than ever, the web is a universal platform for all types of applications, and JavaScript is the language of the web. If youre serious about web development, its not enough to be a decent JavaScript coder. You need to be ninja-stealthy, efficient, and ready for anything. This book shows you how.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Technology

JavaScript is rapidly becoming a universal language for every type of application, whether on the web, on the desktop, in the cloud, or on mobile devices. When you become a JavaScript pro, you have a powerful skill set thats usable across all these domains.

About the Book

Secrets of the JavaScript Ninja, Second Edition uses practical examples to clearly illustrate each core concept and technique. This completely revised edition shows you how to master key JavaScript concepts such as functions, closures, objects, prototypes, and promises. It covers APIs such as the DOM, events, and timers. Youll discover best practice techniques such as testing, and cross-browser development, all taught from the perspective of skilled JavaScript practitioners.

Whats Inside

  • Writing more effective code with functions, objects, and closures
  • Learning to avoid JavaScript application pitfalls
  • Using regular expressions to write succinct text-processing code
  • Managing asynchronous code with promises
  • Fully revised to cover concepts from ES6 and ES7

About the Reader

You dont have to be a ninja to read this bookjust be willing to become one. Are you ready?

About the Authors

John Resig is an acknowledged JavaScript authority and the creator of the jQuery library. Bear Bibeault is a web developer and author of the first edition, as well as coauthor of Ajax in Practice, Prototype and Scriptaculous in Action, and jQuery in Action from Manning. Josip Maras is a post-doctoral researcher and teacher.

Table of Contents

    PART 1 - WARMING UP
  1. JavaScript is everywhere
  2. Building the page at runtime
  3. PART 2 - UNDERSTANDING FUNCTIONS
  4. First-class functions for the novice: definitions and arguments
  5. Functions for the journeyman: understanding function invocation
  6. Functions for the master: closures and scopes
  7. Functions for the future: generators and promises
  8. PART 3 - DIGGING INTO OBJECTS AND FORTIFYING YOUR CODE
  9. Object orientation with prototypes
  10. Controlling access to objects
  11. Dealing with collections
  12. Wrangling regular expressions
  13. Code modularization techniques
  14. PART 4 - BROWSER RECONNAISSANCE
  15. Working the DOM
  16. Surviving events
  17. Developing cross-browser strategies

John Resig: author's other books


Who wrote Secrets of the JavaScript Ninja? Find out the surname, the name of the author of the book and a list of all author's works by series.

Secrets of the JavaScript Ninja — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Secrets of the JavaScript Ninja" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Secrets of the JavaScript Ninja, Second Edition
John Resig Bear Bibeault Josip Maras

Secrets of the JavaScript Ninja - image 1

Copyright

For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact

Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com

2016 by Manning Publications Co. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.

Picture 2Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.

Picture 3Manning Publications Co.20 Baldwin RoadPO Box 761Shelter Island, NY 11964
Development editor: Dan MaharryTechnical development editor: Gregor ZurowskiReview editor: Ozren HarlovicProject editor: Tiffany TaylorCopy editor: Sharon WilkeyProofreader: Alyson BrenerTechnical proofreaders: Mathias Bynens,Jon BorgmanTypesetter: Gordan SalinovicCover designer: Marija Tudor

ISBN 9781617292859

Printed in the United States of America

1 2 3 4 5 6 7 8 9 10 EBM 21 20 19 18 17 16

Brief Table of Contents
Table of Contents
ES6 cheat sheet

Template literals embed expressions into strings: `${ninja}`.

Block-scoped variables:

  • Use the new let keyword to create block-level variables: let ninja = "Yoshi".
  • Use the new const keyword to create block-level constant variables whose value cant be reassigned to a completely new value: const ninja = "Yoshi".

Function parameters:

  • Rest parameters create an array from arguments that werent matched to parameters:function multiMax(first, ...remaining){ /*...*/}multiMax(2, 3, 4, 5); //first: 2; remaining: [3, 4, 5]
  • Default parameters specify default parameter values that are used if no value is supplied during invocation:function do(ninja, action = "skulk" ){ return ninja + " " + action;}do("Fuma"); //"Fuma skulk"

Spread operators expand an expression where multiple items are needed: [...items, 3, 4, 5].

Arrow functions let us create functions with less syntactic clutter. They dont have their own this parameter. Instead, they inherit it from the context in which they were created:

const values = [0, 3, 2, 5, 7, 4, 8, 1];values.sort((v1,v2) => v1 - v2); /*OR*/ values.sort((v1,v2) => { return v1 - v2;});value.forEach(value => console.log(value));

Generators generate sequences of values on a per-request basis. Once a value is generated, the generator suspends its execution without blocking. Use yield to generate values:

function *IdGenerator(){ let id = 0; while(true){ yield ++id; }}

Promises are placeholders for the result of a computation. A promise is a guarantee that eventually well know the result of some computation. The promise can either succeed or fail, and once it has done so, there will be no more changes:

  • Create a new promise with new Promise((resolve, reject) => {});.
  • Call the resolve function to explicitly resolve a promise. Call the reject function to explicitly reject a promise. A promise is implicitly rejected if an error occurs.
  • The promise object has a then method that returns a promise and takes in two callbacks, a success callback and a failure callback:myPromise.then(val => console.log("Success"), err => console.log("Error"));
  • Chain in a catch method to catch promise failures: myPromise.catch(e => alert(e));.

Classes act as syntactic sugar around JavaScripts prototypes:

class Person { constructor(name){ this.name = name; } dance(){ return true; }}class Ninja extends Person { constructor(name, level){ super(name); this.level = level; } static compare(ninja1, ninja2){ return ninja1.level - ninja2.level; }}

Proxies control access to other objects. Custom actions can be executed when an object is interacted with (for example, when a property is read or a function is called):

const p = new Proxy(target, { get: (target, key) => { /*Called when property accessed through proxy*/ }, set: (target, key, value) => { /*Called when property set through proxy*/ }});

Maps are mappings between a key and a value:

  • new Map() creates a new map.
  • Use the set method to add a new mapping, the get method to fetch a mapping, the has method to check whether a mapping exists, and the delete method to remove a mapping.

Sets are collections of unique items:

  • new Set() creates a new set.
  • Use the add method to add a new item, the delete method to remove an item, and the size property to check the number of items in a set.

for...of loops iterate over collections and generators.

Destructuring extracts data from objects and arrays:

  • const {name: ninjaName} = ninja;
  • const [firstNinja] = ["Yoshi"];

Modules are larger units of organizing code that allow us to divide programs into clusters:

export class Ninja{}; //Export an itemexport default class Ninja{} //Default exportexport {ninja};//Export existing variablesexport {ninja as samurai}; //Rename an exportimport Ninja from "Ninja.js"; //Import a default exportimport {ninja} from "Ninja.js"; //Import named exportsimport * as Ninja from "Ninja.js"; //Import all named exportsimport {ninja as iNinja} from "Ninja.js"; //Import with a new name
Praise for the First Edition

Finally, from a master, a book that delivers what an aspiring JavaScript developer requires to learn the art of crafting effective cross-browser JavaScript.

Glenn Stokol, Senior Principal Curriculum Developer, Oracle Corporation

Consistent with the jQuery motto, Write less, do more.

Andr Roberge, Universit Saint-Anne

Interesting and original techniques.

Scott Sauyet, Four Winds Software

Read this book, and youll no longer blindly plug in a snippet of code and marvel at how it worksyoull understand why it works.

Joe Litton, Collaborative Software Developer, JoeLitton.net

Will help you raise your JavaScript to the realm of the masters.

Christopher Haupt, greenstack.com

The stuff ninjas need to know.

Chad Davis, author of Struts 2 in Action

Required reading for any JavaScript Master.

John J. Ryan III, Princigration LLC

This book is a must-have for any serious JS coder. Your knowledge of the language will dramatically expand.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Secrets of the JavaScript Ninja»

Look at similar books to Secrets of the JavaScript Ninja. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Secrets of the JavaScript Ninja»

Discussion, reviews of the book Secrets of the JavaScript Ninja and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.