I my jade view I give the array 'arr':
server.js
app('/', function (req, res) {
res.render('index', {
arr: [1,2,3]
});
});
I my index view I need to make something like this:
index.jade:
- if (arr && arr.length) {
for (var i=0; i<arr.length; i++)
div(class='div-'+arr[i])
- }
Eventually I want to get the following html code:
<div class='div-1'>
<div class='div-2'>
<div class='div-3'>
But it does work. What's wrong?