Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
why Ejs not being recognized by vscode

I have searching for solutions but nothing working. I installed ejs extention on vs code and also dependency. added *ejs and html in setting and tried several solution on StackOverFlow. The answer should come as Its a Weekend or Weekday but <%KindOfDay%> EJS not working.

/view/list.ejs code is:

<body>
    <h1>Its a <%KindOfDay%> </h1>
</body>

and app.js code is:

const express = require("express");
const bodyParser = require("body-parser");


const app = express();

app.set('views', path(__dirname, 'views'));
app.set('view engine', 'ejs');


app.get("/", (req, res) => {

    var today = new Date();
    var currentDate = today.getDate();
    var day = "";

    if (currentDate == 6 || currentDate == 0) {
        day = "Weekend";
    } else {
        day = "Weekday";
    }

    res.render("list", { KindOfDay: day });
console.log(day);
});

app.listen(3000, () => {
    console.log("Server Running");
})

I am providing screenshots and marked in red.

enter image description here

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are wrong tag to display an output. To display output write like this

<%= KindOfDay %>

The one you are using is 'Scriptlet' tag, for control-flow, no output. It is used with loops and if else statements etc.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!