-2
Good people, I’m starting in javascript and I came across this exercise. it is possible to help in the resolution?
We have a very poorly created user. We want him to please ask at the end of each question. Do a feature that adds ", Please?" at the end of each question.
That is, the use of this would be:
const phrase = makePoliteQuestion('Can you open the door?');
//phrase seria 'Can you open the door, please?'
But only if it’s a question! That is to say,
const phrase = makePoliteQuestion('Open the door.');
//phrase seria 'Open the door.'
Help: Try to split the function into several small functions! (For example, checking if it is a question can be a single function)