mercredi 4 novembre 2020

Facing error in if else clause in javascript "SyntaxError: expected expression, got keyword 'else' @(shell):1:0"

This is my if else clause:

var count_listings=db.getCollection('listings').count();
if(count_listings>59999999) {
 ap="listings count is valid="+count_listings;
}
else  {
out="listings count is invalid="+count_listings;
}

But it says that expression is missing.

Error log: "2020-11-04T14:16:06.062+0530 E QUERY [thread1] SyntaxError: expected expression, got keyword 'else' @(shell):1:0"

Can anybody help what the problem is?

Aucun commentaire:

Enregistrer un commentaire