I am new to coding in general, and have been working with javascript for awhile now - apologies in advance for any missteps I may have made in posting this question. I researched for the better part of 2 hours and was unable to come up with an answer on my own, so I made an account here.
I came across this answer/code, and am struggling to understand certain aspects of the code. I made it work in my code, but I want to wrap my head around the specific aspects that I don't quite understand.
Specifically, I don't understand how 1) the variable works when it is assigned 3 definitions, with each followed by a comma - which does the variable refer to? Once all of the assignments are defined by the end of the script, how does it know which to use next?
2) I need some clarification on the "switch" portion, and how it works. How does defining each in succession according to the last, encourage the code to switch?
Thank you so much in advance.