Extra Practice

Remember: Learning to program takes practice! It helps to see concepts over and over, and it's always good to try things more than once. We learn much more the second time we do something. Use the exercises and additional self-checks below to practice.

// Refer to this code to answer the questions.
let x = 12;
let y = 3;

let z = x % y;

let foo = 5;
x = 16;
let bar = x % foo;

/* let z = 42; */

let baz = z + bar;

What is the first line of the code above?

aside note comment instructions The first line of the code above is a comment.

What do we call x and y?

parameters variables attributes indices In this example, x and y are variables.

At the end of this script, what is x equal to?

16 12 42 80 At the end of this code, x is equal to 16.

At the end of this code, what is baz equal to?

12 36 0 1 The variable baz is equal to 1.

At the end of this code, why doesn't z equal 42?

It just doesn't. The statement setting z to that value has been commented out. z is a constant and cannot be updated. The variable z is not equal to 42 because the line setting that value has been commented out.

Visit Content Online

The content on this page has been removed from your PDF or ebook format. You may view the content by visiting this book online.

results matching ""

    No results matching ""