send variable data from node js to front end javascript

JavaScript
<script>
   window.app = <%- JSON.stringify(data) %>
</script>
Source

Also in JavaScript: