Together, selection and repetition statements are known as control structures. JavaScript supports two selection statements and three repetition statements. The if/else selection statement is the basic decision-making statement in JavaScript. switch/case statements perform the same basic type of selection but only on lists of primitive values. The for and while loops are nearly identical in function and are used for repeating several statements many times. The for-in repetition statement is designed to loop through arrays or collections of data very efficiently. The total running time of a program can be greatly improved by decreasing the number of instructions inside a loop. There are two ways you can optimize your loops, code motion and reduction in strength.