JSFiddle - React, Tailwind, and code Playground

by Eugen Sunic

JavaScript

const a = document.getElementsByTagName('h6');
const arr = [];

for (let i = 0; i < a.length; i++) {
  if (i % 3 === 0) {
    arr.push(a[i].children[0].innerText.trim().length)
  }
}
console.log(Math.max(...arr))

const result = Math.max(...Array.from(document.getElementsByTagName('h6')).reduce((acc, x, i) => {
  if (i % 3 === 0) {
    return [...acc, x.children[0].innerText.trim().length]
  }
  return acc;
}, []))
console.log(result)