- script.js
JavaScript
var mode = 'pageCopy'; // Printing driver mode
var pageNumber = 5; // Copied page number
var copyCount = 7; // Number of copies
var totalPages = 6; // Pages in the document
if (mode === 'pageCopy') {
for (var copies = 1; copies <= copyCount; copies++) {
muffin.print(pageNumber);
}
}
Result
Goalscompleted
Let’s add the printing mode for all pages of the document.
- At the end of the program, add a check that compares
mode
with the value of'document'
. - Inside this check, add a loop that increases the value of
page
valuable from1
tototalPages
inclusively. - Inside the loop, add the print command for the current page
page
. - Change the value of the
mode
variable to'document'
.
Comments