Enclose In Brackets

Description


Given a string, enclose it in round brackets.

Example

For inputString = "abacaba", the output should be encloseInBrackets(inputString) = "(abacaba)".

Input/Output

  • [execution time limit] 4 seconds (js)

  • [input] string inputString

    Guaranteed constraints:
    0 ≤ inputString.length ≤ 10.

  • [output] string

[JavaScript (ES6)] Syntax Tips

1
2
3
4
5
6
// Prints help message to the console
// Returns a string
function helloWorld(name) {
console.log("This prints to the console when you Run Tests");
return "Hello, " + name;
}

Solution


1
2
3
function encloseInBrackets(inputString) {
  return `(${inputString})`;
}