Sure! Here's an example of a simplified text-based game based on Five Nights at Freddy's using JavaScript. Please note that this is a very basic implementation and doesn't include images or advanced game mechanics.
To play the game, open the HTML file in a web browser. Each night, you'll be prompted to enter an action: either "hide" or "run". Choose your action wisely and try to survive as many nights as possible. If Freddy catches you, the game will end with a jumpscare message.