Learning JavaScript: A Sequential Theory of Instruction

Learning JavaScript: A Sequential Theory of Instruction

This article begins a series of articles on learning how to program in JavaScript. JavaScript is an excellent first-time language because of its usefulness. JavaScript runs in the two main environments most people use — the web browser and the desktop. JavaScript is also a very practical language to learn because there are lots of applications and jobs that either require or can use JavaScript for programming purposes.

This article begins a series of articles on learning how to program in JavaScript. JavaScript is an excellent first-time language because of its usefulness. JavaScript runs in the two main environments most people use — the web browser and the desktop. JavaScript is also a very practical language to learn because there are lots of applications and jobs that either require or can use JavaScript for programming purposes. For all these reasons, and many more, if you are just starting out learning to program JavaScript is an excellent first language.

How to Learn to Program

There are hundreds, if not thousands, of sites that offer tutorials on learning how to write computer programs. Many of these tutorials start out with the classic “Hello, world!” example where the learner is shown how to get the phrase “Hello, world!” to display on the screen, and from there the tutorial moves right into showing the learner how to write code to do arithmetic and then on to if statements and loops and functions. The learner is soon drowning in code writing without perhaps understanding what is going on with the code they are writing.

The series of articles I’m going to write take a different approach. Here are the steps I plan to follow for each major JavaScript feature.

Step 1: Learning to Read Code through Variable Tracing

The first thing a new programming student should be learning is how to read programs and understand what they are doing. One of the best ways to learn code reading skills is to learn to trace the values of variables through a program, which is called variable tracing.

Variables are traced by writing down each variable used in a program and the value the variable is storing during each step of a program. Here is a simple JavaScript example, first with a short program, followed by a variable trace:

let salary = 2000;
let deductions = .25;
let net_salary =  salary – (salary * deductions);
salary = 3000;
deductions = .30;
net_salary = salary – (salary * deductions);

Here is the variable trace:

salary — 2000

deductions — .25

net_salary — 1500

salary — 3000

deductions — .30

net_salary — 2250

When the learner can successfully update the values of variables as they read through the program, they are mastering the ability to successfully read code.

As the learner moves through the various JavaScript constructs (ifforwhile, etc.), variable tracing will get harder but will prove more valuable to the learner.

javascript learning-javascript learning-to-code programming

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Learning JavaScript: for Loops

In this article I’m going to cover the different forms of the for loop that are available in JavaScript. There is the general for loop, the for..in loop, and the for..of loop. I will describe how each loop works and when is the right time to use each loop type. I am leaving out the Array.forEach loop as it is specialized for arrays and requires some knowledge of functions I haven’t covered yet.

13 Free/Low-Cost Sites to Supercharge Your Programming Self-Education

Although we still talk about programming as a standalone career, the dominance of technology in our lives makes it clear that coding is much more than a career path. In my opinion, computer science is more than a college major or a high-paid job; it’s a skill, essential for thriving in a modern-day economy. Whether you work in healthcare, marketing, business, or other fields, you will see more coding and have to deal with a growing number of technologies throughout your entire life.

Learning JavaScript: Computing with Object Methods

JavaScript has a set of built-in methods you can use with your user-defined objects. In this article I’m going to discuss several of these methods and how you can use them in your JavaScript programs.

Learning JavaScript: Working with Strings

Strings are the second most common data type used in JavaScript, and in many cases, since JavaScript is so widely used for web applications, it is the prominent data type.

Learning JavaScript: Statements, Arithmetic, and Math

In this article I will discuss how to perform arithmetic and more advanced mathematical operations in JavaScript. First, though, I need to discuss how statements are formed and used in JavaScript.