Project Mammut Wiki
projectmammut.com
Project Mammut is currently in open beta. The UI is being updated a lot during this time, and you may run into bugs. If you'd like to help develop the engine or suggest features, come find us on Bluesky or Discord.

Learning JavaScript

Written 19 Nov 2026 · Requires Mammut 0.9.0+

Mammut's scripts are written in JavaScript or TypeScript. You don't need to know much to get started, because the script editor suggests what's available as you type. This page lists free courses, guides and references to learn from, and the parts of the language Mammut uses most.

Most courses teach JavaScript for building websites. A Mammut game is a web page, so nearly everything they teach applies. You can skip the parts about setting up files, <script> tags, import and export, Node.js, npm and frameworks such as React. In Mammut you write inside a scene script instead, which is laid out a little differently. See JavaScript in Mammut once you know the basics.

Where to start

  1. If you've never programmed before, start freeCodeCamp's JavaScript course or The Modern JavaScript Tutorial
  2. Once JavaScript feels comfortable, read TypeScript for JavaScript Programmers.

JavaScript courses

Practice

  • Exercism JavaScript: small exercises that check your answer, with optional feedback from volunteer mentors.

Debugging

  • To see what your own game is doing while it runs, see Debugging.

References

From version 0.9.22, hold Ctrl (⌘ on a Mac) and click a built-in like Math.floor in the script editor to open its MDN page. Engine commands like SceneManager.SwitchScene open their page in this wiki.

What Mammut uses most

You'll use these in almost every script, so they're worth learning well:

Topic Where you'll use it Learn it
Objects and methods A scene script is the inside of an object Object initializer, Method definitions
this Every member of your script is reached through this this
Arrow functions Callbacks inside methods, such as timers Arrow functions
The DOM this.dom holds the scene's elements, so you can change their text, style and classes DOM scripting
Events Reacting to clicks and key presses Events
Promises and await Waiting for a state's animation, a scene switch or a chapter to finish Asynchronous JavaScript, async function
Template literals Building text with values in it, like `Score: ${score}` Template literals
Optional chaining Calling something that might not be there, like SceneManager.GetScene("hud")?.addCoins?.(1) Optional chaining

Learning TypeScript

TypeScript is JavaScript with types added, so learn JavaScript first. Everything you know carries over, and TypeScript lets the editor catch mistakes as you type. New scenes start in TypeScript.

Mammut's TypeScript checking is relaxed, so you don't have to add types everywhere. You'll mostly write types on your own script members, with as. See Script Types.

Mammut's own guides

  • JavaScript in Mammut: why scene scripts are laid out the way they are.
  • Scene Script: the parts of a scene script and when they run.
  • TypeScript: choosing a language, and what the editor checks.
  • Script Types: how this.dom, this.vars and your own members are typed.
  • Scripting API: every command the engine gives you, with examples.
  • Debugging: finding out what's going wrong while your game runs.