R
R
Roman Ismailov2017-11-06 16:43:47
JavaScript
Roman Ismailov, 2017-11-06 16:43:47

How to properly declare an array in jade?

Hello!
I'm trying to declare an array in jade with line breaks, for readability, but the console swears at a dash if I try to do this:

-
  var infoPerson = [
    {
      'label': 'Полное ФИО',
      'inputValue': '...'
    },
    {
      'label': 'Год рождения',
      'inputValue': '...'
    },
    {
      'label': 'Место жительства',
      'inputValue': '...'
    },
    {
      'label': 'Скайп',
      'inputValue': '...'
    },
    {
      'label': 'Почта',
      'inputValue': '...'
    }
  ];

writes the following error: unexpected text -
And if you remove the line break, after the dash which, then it writes this: unexpected text {
How can I correctly declare an array in a variable?
PS In pug I implemented the first option, everything worked without errors.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dom1n1k, 2017-11-06
@Benny_Lilom

It is in jade that needs to be done, and not pug?
Then, most likely, it will not work, because support for multi-line array writing appeared there relatively recently (about 2 years ago), after renaming like.
Why do you need jade?

D
Dmitry Lokshin, 2017-11-06
@Ddmitrich

instead of a dash, use:

script.
   // Тут пишем сам скрипт

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question