①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 using 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 this loop and then executes the following loops, while break terminates the loop completely.
It can be understood that continue means skipping the remaining statements in the current loop and executing the next loop.
②toFixed() method can round Number to a number with specified 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 yuan