diffuse javascript
play

Diffuse JavaScript Christian Queinnec Professor emeritus Sorbonne - PDF document

Diffuse JavaScript Christian Queinnec Professor emeritus Sorbonne University December 17, 2018 This document is the PDF version of the slides accompanying the MOOC Diffuse JavaScript. This document is covered by the Creative Commons


  1. Diffuse JavaScript Christian Queinnec Professor emeritus Sorbonne University December 17, 2018 This document is the PDF version of the slides accompanying the MOOC “Diffuse JavaScript”. This document is covered by the Creative Commons license CC-BY-NC- SA. The structure of this document reflects the structure required for OpenEdX. It con- tains links to the Jasmine test specifications (identified by a SPECS box), links to the videos where I comment examples of code (identified by VIDEO box), links to the associated tran- scripts and associated code (identified by Transcript ). Some sections are marked with DETAIL , they may be skipped at first reading. You may prefer the HTML version (easier to browse) of this document or the PDF version (easier to print) or the inline chopped version. 1

  2. Diffuse Javascript CONTENTS Contents 1 Before we start... 5 1.1 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 JavaScript - the language 8 2.1 Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Presentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.1 JavaScript: a programming language . . . . . . . . . . . . . . . . . 8 2.3 Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.1 Taxonomy of values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.2 Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.3 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.4 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.4 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4.1 Main syntactic features . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5.1 Characteristics of objects . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5.2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6 Special values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.1 Special values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.7 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.7.1 Characteristics of arrays . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.8 Regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.8.1 Regular expressions aka RegExps . . . . . . . . . . . . . . . . . . . 16 2.9 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.9.1 Predefined classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.10 Comparisons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.10.1 Equalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.11 Coercions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.11.1 Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.12 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.12.1 About expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 2.13 Functions and variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.13.1 Variables and scope . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.14 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.14.1 The typeof operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.15 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.15.1 The function declaration . . . . . . . . . . . . . . . . . . . . . . . . 21 2.15.2 Embedded scopes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.16 Global environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.16.1 Characteristics of global environments . . . . . . . . . . . . . . . . 23 2.17 Closures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.17.1 Characteristics of closures . . . . . . . . . . . . . . . . . . . . . . . . 23 2.18 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.18.1 Generation of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.18.2 Functions and hashtables . . . . . . . . . . . . . . . . . . . . . . . . 27 2.19 Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.19.1 The new keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.19.2 Property lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 by Christian Queinnec 2

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend