Function javascript

Asked

Viewed 2,189 times

-3

Sets the function today Magazine, which receives by parameter a string that informs the day of the week. This function should return"Today is football day!!!" if parameter is "Sunday", otherwise it should return "Today is not football day :(".

function hojeSeJoga(diaDaSemana) {
if (diaDaSemana === "domingo") {
    return 'Hoje é dia de futebol!!!';
} else {
    return 'Hoje não é dia de futebol'
}

}

Guys this formula is giving error you can help me!

  • The question remains very poorly formulated. How do you call the function to test? What is the value of the parameter diaDaSemana - numeric, string, date...? Did you notice that you are comparing a variable to itself (hojeSeJoga == hojeSeJoga)? You have noticed that this variable is the function name itself, and therefore it cannot contain the name of a day?

1 answer

1

You were miscomparing the information. You should compare with the parameter and not with the function name

function hojeSeJoga(diaDaSemana) {
    if (diaDaSemana === "domingo") {
        return 'Hoje é dia de futebol!!!';
    } else {
        return 'Hoje não é dia de futebol'
    }
}
  • Hi Douglas still this error appears: Your solution did not pass the proofs Objectives that were not met: hojeSeoga makes comparisons against strings Test results: hojeSeoga("Sunday") should say if you play hojeSeoga("Tuesday") I should say you don’t play

  • Marcos, your problem has not been well described. I believe you are passing this function on some tool that checks if the code is correct. According to what you described now, it seems to me that you are returning the wrong sentences there within the "Return". Try to change the returned sentences, maybe that’s the problem.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.