JSFiddle - React, Tailwind, and code Playground

JavaScript

// JavaScript syntax
const z = function() {
    // Zero arguments because zero is a constructor taking 0 arguments
    // in our signature \Sigma
    return 0;
};

const succ = function(x) {
    // One argument because succ is a constructor taking exactly 1 argument
    // in our signature \Sigma
    return x + 1;
};

// The above defines a primitive recursive function on Nat
// We now evaluate it on 3
const result = succ(succ(succ(z())));
alert(result);