chapter

menu1. Welcome to Programming

monaco

1 Welcome to Programming

Real wealth is created by operations — the work of turning inputs into something worth more than the parts you started with. Raw materials, labor, equipment, and information go in; finished goods and satisfied customers come out. Everything you will study in this course is, at bottom, about making that transformation faster, cheaper, and more reliable. This book adds one more tool to that work: the ability to direct it with code.

1.1 What Programming Actually Is

Programming is the craft of giving a computer clear, precise instructions so it can do work for you. It is a kind of conversation — you learn to express a task in a language the machine understands, and it does exactly what you describe. Not what you meant, not roughly what you asked, but precisely what your instructions say. That exactness is what makes programming both powerful and, now and then, humbling.

If this sounds familiar, it should: an operation is also a sequence of precise steps. “Reorder parts when we’re running low” is how a person says it. A computer can’t act on that — it needs the exact rule: when on-hand quantity falls to or below the reorder point, place an order. Writing a program is the discipline of turning a fuzzy operational intention into steps explicit enough that a machine can carry them out the same way every time.

A recipe is a program. A set of directions is a program. A standard operating procedure is very nearly a program already. The difference is that a person fills in gaps — “cook until done,” “restock as needed” — and a computer cannot. It needs every step, in order, with no ambiguity.

So programming is more than syntax. It is learning to think in a way a computer can follow: breaking a problem into smaller steps, testing your assumptions, building something small and growing it piece by piece. Over time you develop a mental toolkit for exactly the kind of structured problem-solving operations work rewards.

JavaScript, the language used throughout this book, is a friendly place to begin. It runs in every modern browser, so you already have what you need to experiment. Write a line, press Enter, see the result. That instant feedback is one reason it became one of the most widely used languages in the world.

By the end of this book you won’t just know some JavaScript — you’ll know how to think like a programmer, and how to put that thinking to work on the operations problems you’ll meet in the rest of the course.

1.2 How Computers Think

If programming is learning to communicate with a computer, it helps to understand what you’re talking to. A computer doesn’t think like a person. It doesn’t guess, infer, or read between the lines. Its version of “thinking” is closer to following a procedure with absolute, unwavering obedience.

Underneath, a computer makes billions of tiny decisions a second, each one trivially simple: yes or no, true or false, on or off. From those microscopic choices everything else is built. Because the machine runs on such strict rules, it needs instructions that are equally strict. Leave out a detail and it won’t supply it. Phrase something vaguely and it won’t interpret your intent. It does exactly what you wrote — even when that’s not what you wanted.

This is why so much of programming is breaking problems down. Consider a task that feels like one action to a person: “flag every item that’s below its reorder point.” To a computer that’s a series of tiny operations — look at the first item, compare its on-hand quantity to its reorder point, decide whether it’s short, record the result, move to the next item, and repeat until the list is done. What we experience as a single thought becomes dozens of precise micro-steps.

The payoff is that once the machine knows those steps, it runs them with speed and consistency no person can match. It never tires, never gets distracted, never skips a line. You can encode an operational process once and have it executed perfectly every time — which is exactly the kind of reliability operations managers spend their careers trying to build.

As you learn to program, you’ll pick up a little of this computational habit of mind: breaking work into pieces, stating it clearly, anticipating the edge cases. You’re not trying to think like a computer — you’re learning to think for one, giving it the structure it needs to do the work you want.

1.3 Why JavaScript Is a Great First Language

Choosing a first programming language is a bit like choosing a first instrument: you want something approachable, versatile, and rewarding enough to make real progress early. JavaScript fits that role well, which is why so many beginners start here.

Its biggest strength is accessibility. You don’t need to install anything — if you have a browser, you can write and run JavaScript and see results instantly. That quick feedback makes learning feel like play rather than a chore. It’s also everywhere: it runs websites, servers, mobile apps, and the office tools you already use to manage operations data. And it’s forgiving — you can experiment, make mistakes, and learn by doing, while the language still has room to grow with you. If you get stuck, a huge community has almost certainly answered your question already.

1.3.1 Beyond the Browser: Where JavaScript Can Run

Most people picture JavaScript running inside a web page. That’s where it began, but the language has grown well past its first home. Today it runs in browsers, on servers, inside office documents, in the cloud, and on your own machine. This book leans into that wider world, because the operations tools you’ll build live where your data already is — in spreadsheets.

1.3.2 JavaScript Variants and Scripting Platforms

Several platforms build on JavaScript to make it more useful for real-world automation:

  • Google Apps Script — a cloud scripting environment that automates and extends Google Workspace (Sheets, Docs, Gmail, Drive) using a JavaScript-like syntax. If you’ve ever wished a spreadsheet could email you when stock runs low, this is how.
  • Microsoft Office Scripts — a close cousin for automating Excel on the web, written in TypeScript.
  • TypeScript — JavaScript plus optional type-checking, widely used on larger projects to catch errors early.

The common theme: they let you use JavaScript to automate everyday workflows, usually without installing anything — which makes them ideal for getting practical results fast.

1.3.3 JavaScript Beyond the Cloud: Node.js

Browser JavaScript is deliberately limited — it can’t touch your file system or your operating system directly. Node.js removes that ceiling, letting JavaScript run on your own machine like any general-purpose language: reading and writing files, building command-line tools and web servers, working with databases, and automating local tasks. It turned JavaScript from a browser-only language into a universal platform.

1.3.4 Why These Environments Matter

Seeing these platforms side by side shows how far one language reaches — the same core JavaScript can automate spreadsheets, extend email, power websites, run servers, and talk to cloud services. Each has its own flavor, but they share a foundation, so once you have the fundamentals you can move between them with surprising ease. This book gives you hands-on time with several, starting where operations data lives.

1.4 How to Run JavaScript

One reason JavaScript makes a great first language is that you can run it almost anywhere, with no special setup. This section covers the main options, from the simplest to the ones you’ll meet later.

1.4.1 Running JavaScript in the Browser Console

Every modern browser ships with a JavaScript console — the fastest way to experiment.

  1. Open any webpage.

  2. Right-click and choose Inspect or Developer Tools.

  3. Open the Console tab.

  4. Type a line such as:

    console.log("Hello from JavaScript!")
  5. Press Enter and see the result instantly.

The console is perfect for trying small ideas without any setup.

A note on semicolons. JavaScript belongs to the “C-family” of languages, many of which require a semicolon to end every statement. JavaScript does not, as long as each statement is on its own line. You’ll see semicolons in lots of online examples out of habit; in this book we leave them off to keep the examples clean. Whether you use them in your own code is up to you.

1.4.2 Running JavaScript in Other Platforms

Throughout the book you’ll also use environments that run JavaScript or a close relative to automate real tasks: online editors like JSFiddle and CodePen, JavaScript embedded in a web page, Google Apps Script for Google Workspace, Microsoft Office Scripts for Excel on the web, cloud runtimes, and Node.js for running code locally. Each runs code a little differently, but the core language stays familiar.

1.4.3 Choosing the Right Environment

There’s no single correct way to run JavaScript — it depends on the job: quick experiments in the browser console, interactive demos in online editors, web projects in HTML + JavaScript, local tools in Node.js, and automation in Apps Script or Office Scripts. Our detailed examples will begin in Google Apps Script, inside the spreadsheets where operations data already lives.