I don’t know if what prison feels like but if its anything like quarantine you will never see me do anything bad or mischievous ever again.
but here some codes
For the blog
- Describe the process for clearing and mapping icons to the DOM. What are the three steps and the core functions? Describe how the four methods used for this process work –
we have to create a variable that contains all the instances of the icon and the instruction using a query selector. in the clear function, we use a statement that check if there is an element within the space we are looking at, to accomplish this we use “.firstElementChild” if there is one the next step is to clear either the icon or instruction using removeChild in which we pass the first child of the element as a reference. For the mapping function we take in the level as a parameter we then access that scenes icons using the level.
2. Describe how the spread operator is used to convert a node list of selected elements into an array. Describe why we needed this conversion and how the array was helpful for our first test in the game’s logic.
The spread operator is necessary because it looks at many arguments in a function and it passes the argument and adds it at one time. it allows us to turn the nodelist into an iterable array with a [i] elements. The i elements is based on how many i elements you have. We are essentially setting iconArr equal to an empty array with the spread operator calling each of the icons from the nodelist.
3. Describe how the scene[level].main(icon, indx) function is called within the check(icon, indx) function. How are we tracking the icon and index values? Why do we need to track and pass the icon and index values to the scene’s main function? What does the scene’s main function do with these values?
within our “check(icon, indx)” function we use “scene[level].main(icon, indx);” in order to access scene-specific instructions. in order to access these instructions, we need to know three vital pieces of information. the first on which is the level, the icon that was clicked on, and the index of the said icon which is passed onto main in the second js file, scences.js, main takes these values and if there are scene-specific instructions they will take place.
4. Describe how the start and finish functions are called in moron.js. How does the program know if there is a start or finish function to run? Where is each start or finish function placed and why?
The start is used if we need to run a function when a scene starts. The main is used for all the logic functions. The finish is if we need to run a function after someone has completed all the clicks they need to click. The start and finish functions are null unless there are things that need to be done at the start of the scene or if things need to be done after the clicks are done.