[FINAL] – The Moron Test – Game Logic

Hi this is tutorials based on the 3 videos (11,12,13). Everything was fine this week but I really struggled with the blog question. I gave the question my best shot but I am still a little confused. It would be great if Mike can give the answer to this blog question. Other than that everything else is great.

Video Walkthrough – Videos 11 – 13

Blog Question

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 operate allows an iterable such as nodelist. The spread operator is necessary because it looks at many arguments in an function and it passes the argument and adds it at one time. In other words, the spread operator allows us to turn the nodelist into an iterable array with i elements. The i elements is based off how many i elements you have. We are essentially setting iconArr equal to an emepty array with the spread operator calling each of the icons from the nodelist.

Join the Conversation

1 Comment

  1. You’ve basically got it. The spread operator turns any iterable into a list of arguments. Add that list to an empty array, then you have an array with all the values from the list. It’s really, really useful syntax. Here’s an interesting post showing a bunch of uses.

Leave a comment

Your email address will not be published. Required fields are marked *