Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Prep exercise - traffic light

Let's have a deeper look at the working of traffic lights this week so that we can practice logic and loops. In the previous week we went into some different ways of representing a traffic light, now let's make the traffic light work. In traffic-light-1.js and traffic-light-2.js you will find the same requirements but with different ways of representing the traffic light. Have a look through the files and solve them.

Things to think about

  • Which way of representing the traffic light did you find better? Why?
  • What happens if you change the loop to a do-while loop instead of a while loop? Why?
  • We could have also used a for loop to make the traffic light do 2 full rotations. Do you think that would be better? Why or why not?