Tell us what’s happening:
Describe your issue in detail here.
If I do not check the like box console.log(like) just before the ternary expression evaluates like to false, yet ip is always added to the database. Only if I replace [ip] by , it will not. I don’t see what is wrong with the ternary expression. And I don’ see the error could be somewhere else.
Your code so far
async function createStock(stock, like, ip) {
const newStock = new StockModel({
symbol: stock,
likes: like ? [ip] : [],
});
const savedNew = newStock.save();
return savedNew;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
For some reason all functional tests pass, even though likes are incorrectly shown in browser. I would really like to fix the issue, because I can’t see anything wrong with the ternary statement.
As for the fcc test on security. It fails. I read that there have been many posts on this topic and would appreciate if anyone could enlighten me on how to pass that test.
@bengitter,
Sorry, this is the link to the code.
You might be right, that it is a string. Well spotted! I am trying to fix it, but am failing miserably. Could you help me?
Would you also have an idea how to pass the security test?