K
K
kavalorn1232018-03-09 21:51:02
JavaScript
kavalorn123, 2018-03-09 21:51:02

How to add data to variable in script tag in pug?

how to add an array with objects (for example) to a variable in pug?
to have something like
var data = #{data};
and rendered as
var data = [{},{},{}];
can you do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fl3nkey, 2018-03-10
@kavalorn123

script.
  var data = !{JSON.stringify(data)}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question