【发布时间】:2019-04-20 22:37:37
【问题描述】:
作为我的问题标题。 我无法打印 var myArray 的值。请帮助我。我开始使用nodejs,ejs。
index.js:
res.render('index',{
nickName: 'My Nick',
fullName: 'My Name',
myArray: [
myClass = 'nodeJs',
mySchool = 'Home School'
]
});
index.ejs
<div>My Nick is: <%= nickName %></div>
<div>My Name is: <%= fullName %></div>
<div>My Class is: <%= myArray['myClass'] %></div> // can't print
<div>My School is: <%= myArray['mySchool'] %></div> // can't print
<div>My Array is: <% myArray.forEach(function(value){ %>
<%= value %>
<% }) %>
谢谢!
【问题讨论】:
标签: ejs