← Back to challenges

Secret Function 4.0

JavaScriptHardstringsarrays

Instructions

Create a function based on the input and output. Look at the examples, there is a pattern.

Examples

secret("p.one.two.three") ➞ `<p class="one two three"></p>`

secret("p.one") ➞ `<p class="one"></p>`

secret("p.four.five") ➞ `<p class="four five"></p>`

Notes

Input is a string.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Evaluating Factorials