The best authors and the best JavaScript developers are those who obsess about language, who explore and experiment with language every day and in doing so develop their own style, their own idioms, and their own expression.
Take your first steps into programming by learning to read, trace, analyze, and write interactive programs in your browser.
By the end of this module using Just Enough JavaScript you will be able to document, plan and develop programs that process a user's text input.
- Learning Objectives: what you can expect to learn from studying this material
- Setting Up: how to set up and study this material
- Study Path: An introduction to the chapters in this repo and the best way to work your way through them.
- Suggested Study: Helpful links for this module, useful but not required.
- Study Tips: Some tips for getting the most out of your time learning to program.
- Lesson Plans: A few ideas for running lessons around this material.
all of these skills are limited to short, single-page programs written with Just Enough JavaScript
Priorities: 🥚, 🐣, 🐥, 🐔 (click to learn more)
There is a lot to learn in this repository. If you can't master all the material at once, that's expected! Anything you don't master now will always be waiting for you to review when you need it. These 4 emoji's will help you prioritize your study time and to measure your progress:
- 🥚: Understanding this material is required, it covers the base skills you'll need for this module and the next. You do not need to finish all of them but should feel comfortable that you could with enough time.
- 🐣: You have started all of these exercises and feel you could complete them all if you just had more time. It may not be easy for you but with effort you can make it through.
- 🐥: You have studied the examples and started some exercises if you had time. You should have a big-picture understanding of these concepts/skills, but may not be confident completing the exercises.
- 🐔: These concepts or skills are not necessary but are related to this module. If you are finished with 🥚, 🐣 and 🐥 you can use the 🐔 exercises to push yourself without getting distracted from the module's main objectives.
- 🥚 Three Audiences: You can explain how a single file of code is used
to communicate with 3 different audiences:
- Developers: You can explain how code formatting, comments, logs and variable names make it easier (or harder!) for a developer to understand a program.
- Computers: You can explain how a computer follows your instructions to store, read and modify data in program memory.
- Users: You can explain how the computer creates a dynamic user experience by following different executions paths depending on user input.
- 🥚 Listening and Reading: You can read code out loud, and understand
your classmates when they read code to you. You don't need to understand
how a program works to master these learning objectives!
- Listening You can exactly re-write a program that a classmate has read
- Reading You can read a program out loud and guide your classmates to re-write exactly the same code without them seeing the program. Every indentation, semi-colon, comment and spelling in their program must be identical to yours.
- 🥚 Static vs. Dynamic Analysis: You can explain and use these two ways
of studying a program, each can help you understand different aspects of
your code. To help understand this concept, the options panel in Study
Lenses is organized into static and dynamic study options:
- Static: Studying the text in a code file without running it. Some static study methods are creating a flowchart, analyzing variables, filling out a trace table, and drawing on code.
- Dynamic: Running code and studying the computer's behavior. Some dynamic study methods are running code and reading console logs, using the trace button, and stepping through in the debugger or JS Tutor.
- 🥚 Analyzing Variables: You can list all the variables in a program,
and answer these 5 questions for each variable:
- Where is the variable declared?
- What is the variable's scope?
- Is the variable initialized with a value?
- How many times is it's value used (read) in the program?
- How many times is the variable assigned a new value?
- What types are assigned to this variable during the program's execution?
- 🥚 Imperative Programming: You can explain what the Imperative Programming paradigm is, and can explain how you know the programs in Welcome to JS are Imperative.
- 🥚 Tracing Execution: You can complete a "steps" trace table and correct your table using console output from the "trace" button.
- 🥚 Stepping Through: You can pause a script in a your browser's debugger, arrange the debugger, collapse extra panels, and step through a script written with Just Enough JS. At each point in execution you can make a prediction of the next line before executing, and can check your prediction using the scopes panel.
- 🥚 Logging: You can tracing specific aspects of a program's execution and log them to the console.
- 🥚 Linting: You can find and fix simple linting errors in JavaScript programs.
- 🐣 Completing Programs: You can successfully fill in blanks for a program when the missing words are provided, including distractors.
- 🐣 Describing Programs: You can read a program and describe it with
comments using to the methodology from
/describing-programs
: zooming out -> zooming in -> connections -> goals - 🐣 Naming Variables: You can analyze how a variable is used in a
program and give it two names:
- Generic: You can give a generic name to a variable based on how it is used in the program.
- Specific: You can give a specific name to a variable based on how it's used and the program's domain (the program's specific data and use-case).
- 🐣 Program Life Cycle: You can explain the two phases of a program's life cycle.
- 🐣 Fixing Errors: You can use the structured comment to describe an error in your program, and can make several educated guesses at how to fix the error.
- 🐣 Fixing Bugs: You can use the structured comment to describe and fix a bug in small programs.
- 🐥 Code Review: Given a working program you can review the code for clarity, correctness and style.
- 🐥 Constructing Programs: You can reconstruct a program's lines and indentation, successfully ignoring distractor lines.
- 🐥 Refactoring: Given a working program, you can make changes to the code without changing the program's behavior.
- 🐥 Modifying Programs: You can make small changes in a program to change it's behavior without breaking it.
- 🐥 Writing Programs: Given a description of a program's behavior (user story + test cases), you can plan goals for the program and write code to pass the tests.
- 🐥 Reverse Engineering: Given a working program with unreadable code,
you can:
- Give the program a name.
- Describe the program's behavior with a user story, acceptance criteria and test cases.
- Plan goals for the program.
- Develop your own working program with the exact same behvior.
- 🐔 Imagining Programs: Given an empty page, you can imagine and
develop your own programs using Just Enough JavaScript. This includes:
- A title.
- A description with a user story, acceptance criteria and test cases.
- Commented goals.
- Fully working Code.
expand/collapse
You will need NPM and nvm on your computer to study this material
Using a browser with good DevTools will make your life easier: Chromium, FireFox, Edge, Chrome
- Install o update the
study-lenses
package globally$ npm install -g study-lenses
(if you do not have it installed)$ npm update -g study-lenses
(if you already have it installed)- Didn't work? you may need to try:
- (mac)
$ sudo npm install -g study-lenses
- (mac)
- having trouble updating?
- try this:
$ npm uninstall -g study-lenses && npm install -g study-lenses
- try this:
- Fork and clone this repository:
- fork the HackYourFuture repository to your personal account
git@github.com:HackYourFutureBelgium/welcome-to-js.git
- clone your fork to your computer
- when there are updates to the module:
- update your fork with a PR
- pull the changes from your fork to your computer
- fork the HackYourFuture repository to your personal account
- Navigate to the module repository in terminal
$ cd welcome-to-js
- Run the
study
command from your CLI$ study
- The material will open in your default browser, you're good to go!
- you can read the
study-lenses
user guide from your browser by navigating tolocalhost:xxxx?--help
- you can read the
If you have a windows computer and get this error:
... /study.ps1 cannot be loaded because running scripts ...
follow the instructions in this StackOverflow answer, that should take care of it ; )
This repository comes with some scripts to check the quality of this code. You can run these scripts to check the code provided by HYF, and to check the code you write when experiment with the examples and complete the exercises.
This script will format all of the code in this repository making sure that all the indentations are correct, the code is easy to read, and letting you know if there are any syntax errors.
This script will check all of the files in your repository for spelling mistakes. Spelling is not just a detail, is important! Good spelling helps others read and understand your programs with less effort.
spell-check
is not so clever though, it doesn't have all possible words in
it's dictionary and it won't know if you wanted to spell a word incorrectly.
If you think one of it's "Unknown word"s is not a problem, you can either ignore
the suggestion or add the word to the "words": [ ... ],
list in
.cspell.json.
This script will lint all the Markdown files in this repository, checking for syntax mistakes and other bad practices. Fixing linting errors will help you learn to write better code by pointing out your mistakes before they cause problems in your program.
Some linting errors will take some practice to understand and fix, but it will be a good use of time.
Just like lint:md
, but for .js
files. This script will lint all of the JS
files in this repository, letting you know if there are any syntax errors or bad
practices.
Study these a little bit every day and add new flashcards for things you don't want to forget.
Cheat sheets and diagrams you can print out and have next to you while studying.
What is a program? What is a programming language? How do programs and people fit together?
Go in depth on JavaScript you need to know for writing interactive text-based programs in the browser. Along the way you will learn how each language feature works in small programs.
Learn how to understand a larger programs by finding connections between the details and the big picture. By the end of this chapter you will know how to read a new program and do a simple code review.
Learn to modify and write larger programs in JavaScript. You'll cover many of the hidden skills necessary to develop quality software and to work collaboratively on a code base.