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.
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.
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.
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.
Since I'm in the very early stages of developing this series, this is subject to change radically without notice
- 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
- 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
- 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
- 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
- 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
- Bindings and
- Sets
- Maps
- Type checking
- Imperative control flow: loops
- 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
- Low-level and high-level languages
- 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
- Lists and linked lists
- Stacks
- Queues and deques
- Trees
- Binary trees
- Graphs