After passing a JSON string to my EJS page, I noticed that it displays the string with inverted commas. To resolve this issue, I am looking for a way to eliminate the inverted comma's and convert the string to UPPERCASE. Does anyone know how to achieve this?
app.get('/ranking/:category', (req, res) => {
var category = req.params.category;
var allCategory = ['webDesigning', 'webDevelopment']
if (category !== undefined) {
for(var i = 0; i < allCategory.length; i++) {
if (allCategory[i] === category) {
res.render('ranking', { name: category })
}
}
}else {
res.render('404');
}
})
Currently, in my EJS code, I am attempting to access the category as shown below.
<h1><%= JSON.stringify(name) %></h1>
The desired output should be:
Web Designing