The difference between break and continue and rounding

①The difference and function of

break and continue Both break and continue are used to control the loop structure, mainly to stop the loop.
1.break
Sometimes we want to terminate the loop when a certain condition occurs instead of waiting until the loop condition is false.
This is what we can do with break. break is used to completely end a loop and jump out of the loop body to execute the statements following the loop.
2.continue
continue is somewhat similar to break, the difference is that continue only terminates the current loop, and then executes the following loop, while break terminates the loop completely.
It can be understood that continue skips the remaining statements in the current loop and executes the next loop.


②The toFixed() method rounds the Number to the specified number of decimal places. toFixed (fixed)
Note: [The numeric parameter of tofixed() must be between 0 and 20, and a in a.tofixed() must be of type number]
Syntax NumberObject.toFixed(num)
(items[i].count*items[ i].price).toFixed(2) output the total price##.00 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327091360&siteId=291194637