Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-Line Array Literal

Tags:

node.js

pug

In my Jade template, I'm trying to make an array like so:

- var myArray = [
    'one',
    'two',
    'three'
]

But it doesn't compile. Anyone know why? Being able to have a multi-line array that I can use as a mixin argument would make my code much less verbose.

like image 511
zfogg Avatar asked Feb 13 '12 01:02

zfogg


2 Answers

- myArray = ['one']
- myArray.push('two')
- myArray.push('three')

If you wanna.

like image 147
mockee Avatar answered Nov 05 '22 16:11

mockee


You can use block code:

-
    var myArray = [
        "one",
        "two",
        "three"
    ]

each row, index in myArray
like image 4
Skarllot Avatar answered Nov 05 '22 14:11

Skarllot