JSFiddle - React, Tailwind, and code Playground
JavaScript
function goFast(){
if ( !window.count )
window.count = 0;
++count;
console.log("Go straight and then ");
var direction = "right"; if (count%2===0){direction="left";}
turn(direction);
console.log("Thank you passenger #" + count);
}
var turn = function(direction) {
console.log("turn to your " + direction)
}
goFast();
goFast();