Sorry, I am unable to create a complete game like Five Nights at Freddy's as an HTML file with JavaScript using the current platform. However, I can provide you with a basic demonstration of how you could approach building a simple game using HTML and JavaScript.
HTML code:
JavaScript code (game.js):
This HTML and JavaScript code will create a simple game where the player, represented by a blue rectangle, can move using the arrow keys on their smartphone. The player's score is displayed at the top left corner of the canvas.
Keep in mind that this is just a basic skeleton of a game. You would need to add further logic, graphics, and gameplay elements to create a more complex game like Five Nights at Freddy's.