Phong Duong


JS object and array in Pug

17-07-2020 | #pug

To define a single line JS object or array, you initialize them as a normal JS line after the dash (-). In case you want to define a multiple line object, you need to put your variable under the dash and indent 1 tab.

// Single line array
- const arr = [1, 2, 3, 4, 5]

// Multiple line object
  const obj = {
     value: "1",
     type: "string"

I create a video if you prefer learning by watching

Share: TwitterFacebookLinkedInHacker News