I was looking at some frontend guidelines on GitHub and saw the following code sample:
// good
const createDivs = howMany => {
if (!howMany) return;
document.body.insertAdjacentHTML("beforeend", "<div></div>");
return createDivs(howMany - 1);
};
createDivs(5);
What does the =>
do and what is it called? I have never seen this idiom before. I tried looking it up but do not know its name and the MDN documentation does not show it.