Skip to content

jasonsbarr/SimplyJavaScript

Repository files navigation

Simply JavaScript: an introduction to modern programming and computer science using the world's most popular programming language

While there are literally thousands of beginner JavaScript tutorials out there, most have at least one of the following fatal flaws:

  • They use outdated JavaScript syntax and programming techniques
  • They teach the JavaScript language, but not good programming fundamentals
  • They give you just enough JavaScript to get by before diving into the framework of the day

My goal here is to create a series of tutorials that avoids these pitfalls and helps students develop a strong foundation in computing, program design, and interacting with machines from a programmer's point of view.

Programming, not web development

The purpose of this series is to teach students how to write well-structured, efficient programs using the JavaScript language.

It is not a web development tutorial.

This is an important distinction. The latter will teach you how to build applications for a specific environment: a web browser and/or web server users will interact with via the browser.

These tutorials will teach you how to program, a skill that will enable you to build applications for any environment.

There's nothing wrong with web development tutorials as such, but it's crucial to have a strong programming foundation. If you know programming, you will build better web applications.

Given that web applications are the most common use for JavaScript, you will also learn a little about how to apply your programming knowledge to both client- and server-side web development, but it's not the main focus.

Computer science fundamentals, with modern programming techniques

After working through these tutorials you will have a solid understanding of basic computer science: how computers work, how machines parse and execute programs, how to organize and process data, and how to evaluate and improve program efficiency.

You will also develop the basic skills needed to write programs other developers can read, understand, and work on (and sometimes that "other programmer" will be you, 6 months in the future).

When you understand these things you'll have a massive advantage over others who have only learned the framework du jour or the basics of the JavaScript language itself.

You'll also be able to apply these fundamentals to any other programming language or framework.

Sources of inspiration

Much of what I write here is influenced by Abelson, Sussman, and Sussman's seminal Structure and Interpretation of Computer Programs, although it is certainly not an attempt to translate SICP into JavaScript.

I've also taken some inspiration from Harvey and Wright's Simply Scheme, which was written as a kind of basic primer for students who are not quite yet to the level of starting with SICP.

I've learned a lot from John DeNero's Composing Programs, which is itself based on SICP and adapted for students beginning with Python as their first language.

Allen Downey's Think Python, 2e and its alternate version Think Java are outstanding introductions to programming for beginners that also emphasize fundamentals of computer science and program design.

The Modern JavaScript Tutorial stands out as a stellar example of a basic JavaScript tutorial that emphasizes modern techniques and code style.

Eloquent JavaScript by Marijn Haverbeke is an excellent introduction to programming that uses JavaScript. I strive for his conciseness and clarity, although I hope the learning curve over the first few chapters is less steep here than it is in his excellent work.

Finally, JavaScript for Impatient Programmers by Dr. Axel Rauschmayer is a fantastic introduction to modern JavaScript for newcomers who already know how to program in another language.

Other versions

Outline/Table of Contents

Since I'm in the very early stages of developing this series, this is subject to change radically without notice

1. Understanding and writing JavaScript programs

  • Hello, world: our first JavaScript program
    • How to access the JavaScript console
    • Writing your first JavaScript program
    • How the interpreter works to run your first program
  • What is a program?
    • Try it yourself: exercises for further learning

2. Working with data and types

  • Data types
  • Built-in JavaScript data types
    • Numbers
    • Arithmetic operations
    • Strings
    • Type coercion
    • Operator overloading
    • Booleans
    • Null and undefined
  • Binding data to names: constants and variables
    • Naming conventions
    • The difficulty of naming things
    • Assignment expressions
    • Variables, constants, and (im)mutability
    • Assigning expressions
  • Try it yourself: exercises for further learning

3. Program control and Boolean expressions

  • Boolean logic and conditional execution
  • Branching algorithms
    • Boolean expressions
    • Booleans and type coercion
  • Control logic: declarative style
    • Short-circuit evaluation
    • The conditional expression
  • Control flow: imperative style
    • Conditional statements
  • Control flow vs. logical flow

Interlude: Setting up your development environment

4. Functions: the building blocks of complex programs

  • Function basics
  • How functions work under the hood
  • Defining your own functions
    • The new way: arrow function expressions
    • The old way: the function keyword
  • Parameters and arguments
    • Default argument values
  • Returning values
    • Void functions
    • The return statement
    • Arrow functions and implicit return
  • Pure vs. impure functions
  • The Function data type

4. Complex data types and iteration

  • Primitive vs. complex data types
  • Primitives as objects
    • String properties and methods
    • Number properties and methods
  • Arrays
    • Creating Arrays
    • Array properties and methods
    • Destructuring and spreading Arrays
  • Iteration with Array methods
  • Objects
    • Creating Objects
    • Properties and methods
    • Destructuring and spreading Objects
  • Iterating over Objects
  • Complex data types and (im)mutability
    • Bindings and const
    • Object.seal
    • Object.freeze
  • Sets
  • Maps
  • Type checking
  • Imperative control flow: loops

Interlude: Programming languages in depth and the history of JavaScript

  • Programming languages are languages
    • Digital representation of human language
    • Elements of programming languages
      • Primitives
      • Syntax
      • Static semantics
      • Semantics
  • Programs and programming languages
    • Low-level and high-level languages
      • Machine code and assembly
      • Machine-independent languages and compiling (Grace Hopper and A-0)
      • The first high-level languages: FORTRAN, LISP, and COBOL
      • Modern programming languages
    • Compiled vs. interpreted
    • Dynamically vs. statically typed
    • Compile time and runtime
  • A very brief history of JavaScript
    • Early history and influences
    • ECMAScript versions 3, 4, and 5
    • NodeJS
    • ECMAScript 6 and beyond
  • Overview of JavaScript's basic syntax
    • Identifiers
    • Statements and expressions
    • Syntactic ambiguities
    • Strict mode

II. Abstracting with functions

##. Scopes and closures

##. Higher-order functions

##. Recursion, but first: recursion

##. Composition and the flow of data

##. Lists and streams

##. Continuations and other declarative control logic

Interlude: Declarative vs. imperative programming styles

III. Abstracting with data

##. Simple vs. compound data

##. Strings and string operations

##. Numbers, math, and dates

##. Arrays and iterators

##. Dictionaries and maps

##. Sequential abstractions

  • Lists and linked lists
  • Stacks
  • Queues and deques

##. Hierarchical abstractions

  • Trees
  • Binary trees
  • Graphs

##. Sorting and searching

Interlude: Algorithms and analysis

IV. Abstracting with state

##. Program state and mutability

##. Objects with prototypes

##. Objects with classes

##. Design patterns

##. Functional Object composition

##. Declarative state with reducers

Interlude: Program decomposition and state management

V. Engineering applications

##. Designing programs

##. Asynchronous basics

##. Events and reactivity

##. Programming the browser: the Document Object Model

##. Programming the server: Understanding Node.js

##. HTTP requests and working with external data sources

##. Full-stack development: Managing state with reactive UI

##. Full-stack development: API development with Node and Express

##. Putting it all together

About

Introduction to modern programming and computer science in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published