Learn ECMAScript discover the latest ECMAScript features in order to write cleaner code and learn the fundamentals of JavaScript

Get up and running with all the new features of ECMAScript and explore new ways of coding with JavaScript. About This Book Grasp the latest features of ECMAScript and the best way to use it in production code Learn newly added native APIs to JS Engine and perform tasks efficiently with a cleaner cod...

Descripción completa

Detalles Bibliográficos
Otros Autores: Mohan, Mehul, author (author), Prusty, Narayan, author
Formato: Libro electrónico
Idioma:Inglés
Publicado: Birmingham, [England] ; Mumbai, [India] : Packt 2018.
Edición:Second edition
Materias:
Ver en Biblioteca Universitat Ramon Llull:https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631588006719
Tabla de Contenidos:
  • Cover
  • Title Page
  • Copyright and Credits
  • PacktPub.com
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Getting Started with ECMAScript
  • The let keyword
  • Declaring function-scoped variables
  • Declaring block-scoped variables
  • Re-declaring variables
  • Closures and let keyword
  • The const keyword
  • The scope of const variables
  • Referencing objects using constant variables
  • When to use var/let/const
  • Let versus var versus const performance benchmarks
  • Immutability in JavaScript
  • Object.freeze versus const
  • Default parameter values
  • The spread operator
  • Other uses of the spread operator
  • Making array values a part of another array
  • Pushing the values of an array into another array
  • Spreading multiple arrays
  • The rest parameter
  • Hoisting
  • Destructuring assignments
  • The array destructuring assignment
  • Ignoring values
  • Using the rest operator in an array destructuring assignment
  • Default values for variables
  • Nested array destructuring
  • Using a destructuring assignment as a parameter
  • Object destructuring assignments
  • Default values for variables
  • Destructuring nested objects
  • Using the object destructuring assignment as a parameter
  • Arrow functions
  • The value of "this" in an arrow function
  • Other differences between arrow and traditional functions
  • Enhanced object literals
  • Defining properties
  • Defining methods
  • Computed property names
  • Trailing commas and JavaScript
  • The semicolon dilemma
  • Automatic semicolon insertion in JavaScript
  • Where to insert semicolons in JavaScript?
  • Summary
  • Chapter 2: Knowing Your Library
  • Working with numbers
  • The binary notation
  • The octal notation
  • The Number.isInteger(number) method
  • The Number.isNaN(value) method
  • isNaN versus Number.isNaN
  • The Number.isFinite(number) method.
  • The Number.isSafeInteger(number) method
  • The Number.EPSILON property
  • Doing math
  • Trigonometry-related operations
  • Arithmetic-related operations
  • Exponential operator
  • Miscellaneous math methods
  • The Math.imul(number1, number2) function
  • The Math.clz32(number) function
  • The Math.sign(number) function
  • The Math.trunc(number) function
  • The Math.fround(number) function
  • Working with strings
  • The repeat(count) method
  • The includes(string, index) method
  • The startsWith(string, index) method
  • The endsWith(string, index) function
  • The indexOf(string) function
  • The lastIndexOf(string)
  • The padStart(length [, padString])
  • The padEnd(length [, padString])
  • Template strings
  • Expressions
  • Tagged template literals
  • Multiline strings
  • Raw strings
  • Escape sequence problem with template literals
  • Arrays
  • The Array.from(iterable, mapFunc, this) method
  • The Array.of(values…) method
  • The fill(value, startIndex, endIndex) method
  • The includes() method
  • The includes() versus the indexOf() method
  • The find(testingFunc) method
  • The findIndex(testingFunc) method
  • The copyWithin(targetIndex, startIndex, endIndex) function
  • The entries(), keys(), and values() methods
  • Array iteration
  • The map() method
  • The filter() method
  • forEach() method
  • some() method
  • Collections
  • ArrayBuffer
  • Typed arrays
  • Set
  • WeakSet
  • Map
  • WeakMap
  • Objects
  • Object.values()
  • Object.entries()
  • The __proto__ property
  • The Object.is(value1, value2) method
  • The Object.setPrototypeOf(object, prototype) method
  • The Object.assign(targetObj, sourceObjs…) method
  • Object.getOwnPropertyDescriptors()
  • Summary
  • Chapter 3: Using Iterators
  • Symbols - primitive data type
  • The typeof operator
  • The new operator
  • Using symbols as the object property keys
  • The Object.getOwnPropertySymbols() method.
  • The Symbol.for(string) method
  • Well-known symbols
  • The iteration protocol
  • The iterator protocol
  • The iterable protocol
  • Generator function
  • The return(value) method
  • The throw(exception) method
  • The yield* keyword
  • The for…of loop
  • Tail call optimization
  • Why tail call optimization?
  • Converting non-tail calls into tail calls
  • Summary
  • Chapter 4: Asynchronous Programming
  • JavaScript execution model
  • The event loop
  • The call stack
  • Stack, queue, and Web APIs
  • Writing asynchronous code
  • Asynchronous code involving events
  • Asynchronous code involving callbacks
  • Promises and async programming
  • Promise states
  • Promises versus callbacks
  • Promise constructor and (resolve, reject) methods
  • The then(onFulfilled, onRejected) method
  • The catch(onRejected) method
  • The Promise.resolve(value) method
  • The Promise.reject(value) method
  • The Promise.all(iterable) method
  • The Promise.race(iterable) method
  • async/await - the future of asynchronous programming
  • async/await versus promises
  • The async function and await keyword
  • Making asynchronous code look synchronous
  • Summary
  • Chapter 5: Modular Programming
  • JavaScript modules 101
  • Implementing modules - the old way
  • Immediately-Invoked Function Expression (IIFE)
  • Asynchronous Module Definition (AMD)
  • CommonJS
  • exports versus module.exports
  • Universal Module Definition (UMD)
  • Implementing modules - the new way
  • Importing/exporting modules
  • Named versus default exports
  • Naming named imports
  • Wildcard imports
  • Additional information on export
  • Additional information on import
  • Tree shaking
  • How tree shaking is performed
  • Using modules on the web
  • Summary
  • Chapter 6: Implementing the Reflect API
  • The Reflect object
  • The Reflect.apply(function, this, args) method.
  • The Reflect.construct(constructor, args, prototype) method
  • The Reflect.defineProperty(object, property, descriptor) method
  • Understanding the data properties and accessor properties
  • The Reflect.deleteProperty(object, property) method
  • The Reflect.get(object, property, this) method
  • The Reflect.set(object, property, value, this) method
  • The Reflect.getOwnPropertyDescriptor(object, property) method
  • The Reflect.getPrototypeOf(object) method
  • The Reflect.setPrototypeOf(object, prototype) method
  • The Reflect.has(object, property) method
  • The Reflect.isExtensible(object) method
  • The Reflect.preventExtensions(object) method
  • The Reflect.ownKeys(object) method
  • Summary
  • Chapter 7: Proxies
  • Proxies in a nutshell
  • Terminology for proxies
  • Working with the Proxy API
  • Proxy traps
  • The get(target, property, receiver) method
  • Rules for using get trap
  • The set(target, property, value, receiver) method
  • Rules for using set trap
  • The has(target, property) method
  • Rules for using has trap
  • The isExtensible(target) method
  • Rule for using isExtensible trap
  • The getPrototypeOf(target) method
  • Rules for using getPrototypeOf trap
  • The setPrototypeOf(target, prototype) method
  • Rule for using setPrototypeOf trap
  • The preventExtensions(target) method
  • Rule for using preventExtensions trap
  • The getOwnPropertyDescriptor(target, property) method
  • Rules for using getOwnPropertyDescriptor trap
  • The defineProperty(target, property, descriptor) method
  • Rule for using defineProperty
  • The deleteProperty(target, property) method
  • Rule for deleteProperty trap
  • The ownKeys(target) method
  • Rules for using ownKeys trap
  • The apply(target, thisValue, arguments) method
  • The construct(target, arguments) method
  • The Proxy.revocable(target, handler) method
  • Use case of revocable proxy.
  • The uses of proxies
  • Summary
  • Chapter 8: Classes
  • Understanding object-oriented JavaScript
  • The JavaScript data types
  • Creating objects
  • Understanding the prototypal inheritance model
  • The constructors of primitive data types
  • Using classes
  • Defining a class
  • The class declaration
  • The class expression
  • The prototype methods
  • Getters and setters
  • The generator method
  • Static methods
  • Implementing inheritance in classes
  • Computed method names
  • The attributes of properties
  • Classes are not hoisted!
  • Overriding the result of the constructor method
  • The Symbol.species static accessor property
  • The new.target implicit parameter
  • Using super in object literals
  • Summary
  • Chapter 9: JavaScript on the Web
  • HTML5 and the rise of modern JavaScript
  • The HTML DOM
  • What is the Document Object Model (DOM)?
  • DOM methods/properties
  • Using the getElementById method
  • Using the getElementsByTagName method
  • Using the getElementsByClassName method
  • Using the querySelector method
  • Using the querySelectorAll method
  • Modern JavaScript browser APIs
  • Page Visibility API - is the user still on the page?
  • navigator.onLine API - the user's network status
  • Clipboard API - programmatically manipulating the clipboard
  • The Canvas API - the web's drawing board
  • The Fetch API - promise-based HTTP requests
  • Fetch API customization
  • Accessing and modifying history with the history API
  • Handling window.onpopstate events
  • Modifying history - the history.go(distance) method
  • Jumping ahead - the history.forward() method
  • Going back - the history.back() method
  • Pushing on the history - history.pushState()
  • Pushing on the history stack - history.replaceState()
  • Summary
  • Chapter 10: Storage APIs in JavaScript
  • HyperText Transfer Protocol (HTTP)
  • What is a TLS/SSL handshake?.
  • Mimicking an HTTP state.