<div id="main"></div>
const printTribRec = function (number) {
  if (number == 0)
    return 0;

  if (number == 1 || number == 2)
    return 1;

  else
    return printTribRec(number - 1) +
      printTribRec(number - 2) +
      printTribRec(number - 3);
}

const printTrib = function (number) {
  return printTribRec(number);
}

// Pass any number. Here we pass 6
document.getElementById("main").innerHTML = printTrib(30);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.