Simulator — Nokia Keypad

lastKey = key; lastKeyTime = now; updateScreen(text);

function onKeyPress(key) let now = Date.now(); if (lastKey === key && (now - lastKeyTime) < 1200) currentPos = (currentPos + 1) % keyMap[key].length; text = text.slice(0, -1) + keyMap[key][currentPos]; else currentPos = 0; text += keyMap[key][0]; Nokia Keypad Simulator