5Making decisions in programs

A graphical representation shows a man with apron standing inside the kitchen and speaking over the phone. A cat is seated behind him.

What you will learn

I’ve described a computer as a sausage machine that accepts an input, does something with it, and then produces an output. This is a great way to start thinking about computers, but a computer does a lot more than that. Unlike a real-life sausage machine, which simply tries to create sausage from anything you put in it, a computer can respond to different inputs in different ways. In this chapter, you’ll learn how to make your programs respond to different inputs. You’ll also learn about the responsibility that comes with making the computer work in this way because you must be sure that the ...

Get Begin to Code with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.