Answer the question
In order to leave comments, you need to log in
What is the correct way to write JS code in Pug?
.block
- for (var x = 0; x < 13; x++)
if x = 0
span Вася
.bottom-line
else if x = 6
span Петя
.bottom-line
else if x = 11
span Юра
.bottom-line
else
span
Answer the question
In order to leave comments, you need to log in
I don't remember how you can use the js for loop in Pug (and I can't check it, because pug online doesn't work), but I usually use the built-in pug loops, for example
.block
each _, x in Array(13)
if x == 0
span Вася
.bottom-line
else if x == 6
span Петя
.bottom-line
else if x == 12
span Юра
.bottom-line
else
span
- for (var x=0; x<13; x++)
if x == 0
span Вася
.bottom-line
else if x == 6
span Петя
.bottom-line
else if x == 12
span Юра
.bottom-line
else
span
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question