Reference · Marking, scores and game rules
eraseWordGamefunction
The last thing typed taken back: romaji not yet a kana first, then the last kana or letter.
Import it
import { eraseWordGame } from "@johnmorrisdotca/kotoba";
Definition
function eraseWordGame(game: WordGame): WordGame
Parameters
| Name | Type | Description |
|---|---|---|
game | WordGame | The current immutable word-game state. |
Returns
WordGame
The last thing typed taken back: romaji not yet a kana first, then the last kana or letter.
Examples
import { eraseWordGame, startWordGame, typeWordGame } from "@johnmorrisdotca/kotoba";
const game = startWordGame("en",5,"apple");
const typed = [..."apple"].reduce((state,key)=>typeWordGame(state,key,1000),game);
console.log(eraseWordGame(typed).typed);[ 'a', 'p', 'p', 'l' ]What it prints (run when this page was built)