Game of life written in javascript