bagaimana melihat apakah jendela memiliki fokus di js
var focused = document.hasFocus();
Selfish Snake
var focused = document.hasFocus();