const buildBiyon = (max) => { let incr = 1; let count = 0; return () => { if (count === 1) { incr = 1; } if (count >= max) { incr = -1; } count = count + incr; return "ニ".repeat(count); }; }; (() => { const biyon = buildBiyon(5); setInterval(() => { history.replaceState({}, '', location.pathname+location.search+`#心配ゴム用 (^ω^)${biyon()}つ`) }, 100); })()
See also blog.sushi.money