How To Deal With This Loop Function R Learnjavascript

How To Deal With This Loop Function R Learnjavascript