Your code is not JavaScript as JavaScript:
- Doesn't have
public
or private
scoping.
- Doesn't have data types declared for arguments or return types.
- Has the
function
keyword, which declares the code as a callable
function.
If you correct these things, you'll have valid JavaScript which will work, but be warned that your logic so far doesn't check if the argument contains the test strings, it checks to see if the input exactly matches the test strings. Additionally, it is a case-sensitive match.
function HW1q5(message)
{
if (message == "hello" || message == "Hello"){
return true;
} else {
return false;
}
}
console.log(HW1q5("hello"));
console.log(HW1q5("Hello"));
console.log(HW1q5("HELLO"));