In gameLoop, look at the difference between new Date and new Date from the last loop (store it in a variable).
In other words:
var lastLoop = new Date();
function gameLoop() {
var thisLoop = new Date();
var fps = 1000 / (thisLoop - lastLoop);
lastLoop = thisLoop;
...
}
thisLoop - lastLoop is the number of milliseconds that passed between the two loops.