while writing a program, you may encounter a situation where you need to perform an iterative action. in these situations, you will need to write loop commands to reduce the number of lines of code.
the for ... in loop is used to iterate over the properties of an object. when we haven't discussed the object yet, you may not feel comfortable with this loop. but once you understand how objects work in javascript, you will find this loop very useful.
javascript provides high control to handle loop commands and switch commands. there may be a situation when you need to exit the loop without having to go to its endpoint. there may also be situations when you want to jump over a part of the code block and start the next loop.
a function is a group of reusable code that can be called anywhere in your program. this makes it unnecessary to write the same code over and over again. it helps programmers write modular code. functions allow a programmer to divide a large program into small and manageable functions.
you may have a situation when you click on a url to go to page x but you are directed to page y. it happens because page redirection - redirects the page. this concept is different from: javascript - refresh page.