Good people, I'm starting in javascript and I came across this exercise. Is it possible to give some help in resolving?
We have a very poor user. We want him to ask at the end of each question. Make a function 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,
const phrase = makePoliteQuestion('Open the door.');
//phrase seria 'Open the door.'
Help: Try splitting the function into several small functions! (For example, checking if it's a question can be a function only)