JSFiddle - React, Tailwind, and code Playground

by legolandbridge

JavaScript

var count = 0; 

function goFast(){
    ++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();