I am learning Web development and using JavaScript and express to code the back-end. I can't figure out why my if else statement is malfunctioning. The problem is it only shows what is written in else statement on the website page. Below is my code -
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.get("/", function(request,response){
var today = new Date();
if(today.getDay() === 6 || today.getDay() === 7) {
response.send("Yeh! it's the weekend");
}else {
response.send("Boo!, I have to work");
}
});
app.listen(3000 , function() {
console.log("Server is running at port 3000");
});
Aucun commentaire:
Enregistrer un commentaire