You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.2 KiB

🌟 Happy?

Notions

devdocs.io/javascript/global_objects/string/includes developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator

Instructions

With all the you know now you are not a truly happy, efficient and independent robot.

You have decided that if someone ask you the question Are you happy? or questions that includes the word happy you will always says that it is true. To do so you will declare the function happy which takes only one argument and returns a boolean.

Examples:

console.log(happy('Are you happy?')) // true
console.log(happy('Happy?')) // true
console.log(happy('Are you happy!')) // false  -> this is not a question
console.log(happy('Are you sad?')) // false  -> wrong question

Any other requests will be denied with a false. (if it is not a question of if it does not have the word happy).

And because you aim for efficiency you will contruct your fonction without the curlys brackets {} and without the keyword return or if.