0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<p>Look at how quickly you are getting along! Let’s remember what else a printer should be able to do:</p>
1
<p>Look at how quickly you are getting along! Let’s remember what else a printer should be able to do:</p>
2
<blockquote><p>The new printer is simple enough, it should be able to print all the pages in direct and reverse order, print even and odd pages and make copies of one page.</p>
2
<blockquote><p>The new printer is simple enough, it should be able to print all the pages in direct and reverse order, print even and odd pages and make copies of one page.</p>
3
</blockquote><p>All we have to do is print even and odd pages. Printing only odd pages is easy:</p>
3
</blockquote><p>All we have to do is print even and odd pages. Printing only odd pages is easy:</p>
4
<ul><li>You need to start printing from the first page.</li>
4
<ul><li>You need to start printing from the first page.</li>
5
<li>After each iteration of the loop, you need to increase the number of the current page by 2, and not by 1.</li>
5
<li>After each iteration of the loop, you need to increase the number of the current page by 2, and not by 1.</li>
6
</ul><p>Perhaps you already noticed that in loops, an increase or decrease of variables by some number is regularly used. And we constantly have to write cumbersome structures, such as page = page + 1. Fortunately, JavaScript has several convenient operators that allow us to shorten the code. Here they are:</p>
6
</ul><p>Perhaps you already noticed that in loops, an increase or decrease of variables by some number is regularly used. And we constantly have to write cumbersome structures, such as page = page + 1. Fortunately, JavaScript has several convenient operators that allow us to shorten the code. Here they are:</p>
7
NameExampleAnalogIncrement (increase by one)i++i = i + 1Decrement (decrease by one)i--i = i - 1C-c-combo!i += 2i = i + 2<p>You can combine not only addition, but also other mathematical operations: subtraction -=, multiplication *=, division /= and calculating the remainder %=. For example, i *= 10 will do the same as i = i * 10.</p>
7
NameExampleAnalogIncrement (increase by one)i++i = i + 1Decrement (decrease by one)i--i = i - 1C-c-combo!i += 2i = i + 2<p>You can combine not only addition, but also other mathematical operations: subtraction -=, multiplication *=, division /= and calculating the remainder %=. For example, i *= 10 will do the same as i = i * 10.</p>