ES6 introduced something cool called generator functions. They are just a regular, old-fashioned function that logs a value 4 times. The first time it runs, it "pauses" on the first line and yields the string value '✨' The second time it running, it starts on the line of the previous yield keyword. Then, it encountered a yield keyword with the value.
2 Comments
Sort: