title: How to pass an object from pug to front end javascript
body: <p>I´m using pug and I want to pass a variable to the front end for information, but when I´m trying to do that it pass like a text.</p>
  
  <p>This is how I do that.</p>
  
  <p>Controller code:</p>
  
  <pre><code>res.render('view/edit', {
       title: 'Title',
       sub:true,
       data: variableObject
   });
  </code></pre>
  
  <p>This is the code in the rendered view:</p>
  
  <pre><code>script(type='text/javascript').
      var x = "#{data}"
      console.log(x);
  </code></pre>
  
  <p>And this is the result of the log</p>
  
  <pre><code>[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
  </code></pre>
  
  <p>I can´t access to the object because is text, is there a way to pass the object like an object?</p>