• Complain

Dr. Axel Rauschmayer - Deep JavaScript

Here you can read online Dr. Axel Rauschmayer - Deep JavaScript full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, 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.

Dr. Axel Rauschmayer Deep JavaScript

Deep JavaScript: summary, description and annotation

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

Dr. Axel Rauschmayer: author's other books


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

Deep JavaScript — 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 "Deep JavaScript" 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
Deep JavaScript
Deep JavaScript

Dr. Axel Rauschmayer

2020

Deep JavaScript
1About this book

  • 1.1
  • 1.2
  • 1.3
  • 1.4
  • 1.5
  • 1.6
  • 1.7
    • 1.7.1
    • 1.7.2
  • 1.8

1.1Where is the homepage of this book?

The homepage of Deep JavaScript is exploringjs.com/deep-js/

1.2What is in this book?

This book dives deeply into JavaScript:

  • It teaches practical techniques for using the language better.
  • It teaches how the language works and why. What it teaches is firmly grounded in the ECMAScript specification (which the book explains and refers to).
  • It covers only the language (ignoring platform-specific features such as browser APIs) but not exhaustively. Instead, it focuses on a selection of important topics.
1.3What do I get for my money?

If you buy this book, you get:

  • The current content in four DRM-free versions:
    • PDF file
    • ZIP archive with ad-free HTML
    • EPUB file
    • MOBI file
  • Any future content that is added to this edition. How much I can add depends on the sales of this book.

The current price is introductory. It will increase as more content is added.

1.4How can I preview the content?

On the homepage of this book, there are extensive previews for all versions of this book.

1.5How do I report errors?
  • The HTML version of this book has a link to comments at the end of each chapter.
  • They jump to GitHub issues, which you can also access directly.
1.6Tips for reading
  • You can read the chapters in any order. Each one is self-contained but occasionally, there are references to other chapters with further information.
  • The headings of some sections are marked with (optional) meaning that they are non-essential. You will still understand the remainders of their chapters if you skip them.
1.7Notations and conventions
1.7.1What is a type signature? Why am I seeing static types in this book?

For example, you may see:

Number . isFinite (num : number ) : boolean

That is called the type signature of Number.isFinite(). This notation, especially the static types number of num and boolean of the result, are not real JavaScript. The notation is borrowed from the compile-to-JavaScript language TypeScript (which is mostly just JavaScript plus static typing).

Why is this notation being used? It helps give you a quick idea of how a function works. The notation is explained in detail in a 2ality blog post, but is usually relatively intuitive.

1.7.2What do the notes with icons mean?

Picture 1Reading instructions

Explains how to best read the content.

Picture 2External content

Points to additional, external, content.

Picture 3Tip

Gives a tip related to the current content.

Picture 4Question

Asks and answers a question pertinent to the current content (think FAQ).

Picture 5Warning

Warns about pitfalls, etc.

Picture 6Details

Provides additional details, complementing the current content. It is similar to a footnote.

1.8Acknowledgements
  • Thanks to Allen Wirfs-Brock for his advice via Twitter and blog post comments. It helped make this book better.

  • More people who contributed are acknowledged in the chapters.

2Type coercion in JavaScript

  • 2.1
    • 2.1.1
  • 2.2
    • 2.2.1
    • 2.2.2
    • 2.2.3
    • 2.2.4
    • 2.2.5
  • 2.3
  • 2.4
    • 2.4.1
    • 2.4.2
    • 2.4.3
    • 2.4.4
  • 2.5
    • 2.5.1
    • 2.5.2
  • 2.6

In this chapter, we examine the role of type coercion in JavaScript. We will go relatively deeply into this subject and, e.g., look into how the ECMAScript specification handles coercion.

2.1What is type coercion?

Each operation (function, operator, etc.) expects its parameters to have certain types. If a value doesnt have the right type for a parameter, three common options for, e.g., a function are:

  1. The function can throw an exception:

    }
  2. The function can return an error value:

    }
  3. The function can convert its arguments to useful values:

    }

In (3), the operation performs an implicit type conversion. That is called type coercion.

JavaScript initially didnt have exceptions, which is why it uses coercion and error values for most of its operations:

assert . equal ( Number ( 'xyz' ) , NaN ) ;

However, there are also cases (especially when it comes to newer features) where it throws exceptions if an argument doesnt have the right type:

  • Accessing properties of null or undefined:

    TypeError: Cannot use 'in' operator to search for 'prop' in null
  • Using symbols:

    TypeError: Cannot convert a Symbol value to a number
  • Mixing bigints and numbers:

    TypeError: Cannot mix BigInt and other types
  • New-calling or function-calling values that dont support that operation:

    TypeError: (intermediate value) is not a constructor
  • Changing read-only properties (only throws in strict mode):

    TypeError: Cannot assign to read only property 'prop'
2.1.1Dealing with type coercion

Two common ways of dealing with coercion are:

  • A caller can explicitly convert values so that they have the right types. For example, in the following interaction, we want to multiply two numbers encoded as strings:

    assert . equal ( Number (x) * Number (y) , ) ;
  • A caller can let the operation make the conversion for them:

    assert . equal (x * y , ) ;

I usually prefer the former, because it clarifies my intention: I expect x and y not to be numbers, but want to multiply two numbers.

2.2Operations that help implement coercion in the ECMAScript specification

The following sections describe the most important internal functions used by the ECMAScript specification to convert actual parameters to expected types.

For example, in TypeScript, we would write:

}

In the specification, this looks as follows (translated to JavaScript, so that it is easier to understand):

}
2.2.1Converting to primitive types and objects

Whenever primitive types or objects are expected, the following conversion functions are used:

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Deep JavaScript»

Look at similar books to Deep JavaScript. 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 «Deep JavaScript»

Discussion, reviews of the book Deep JavaScript 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.