Ask coding questions

← Back to all posts
Modify the function to return the given string with an exclamation mark
kyleekeith (0)

I'm having issues with a code challenge and I'm a little stumped. If someone would be kind enough to help me understand what Im doing wrong I feel like this is simple but Im just not grasping it.
Modify the function to return the given string with an exclamation mark added to the end of it.

function addExclamation(s) {

/ Do not modify code below this line /

console.log(addExclamation('hello world'), '<-- should be "hello world!"');

Commentshotnewtop
joshhies (139)

return s + "!";

python is simple, not that hard.

If you like this answer, plz click upvote and check this as answer.

vedprad1 (694)
function addExclamation(s) {
  return s + '!';
}

Very simple.
If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!

ash15khng (234)

Just do return s + "!";
return returns the string, and s+"!" concatenates the string s with "!". (concatenate means put together)