app.get('/test', function (req, res) {
res.render('test',{"test":['test','test1','test2']});
})
前端代码
<script type="text/javascript">
var json = '<%- JSON.stringify(test) %>';
json = JSON.parse(json);
console.log(json[0]);
</script>