← Back to challenges

Know Your Neighbor

JavaScriptHardregexstringsconditionsvalidation

Instructions

Create a function that takes a string as an argument and returns true if each letter in the string is surrounded by a plus sign. Return false otherwise.

Examples

plusSign("+f+d+c+#+f+") ➞ true

plusSign("+d+=3=+s+") ➞ true

plusSign("f++d+g+8+") ➞ false

plusSign("+s+7+fg+r+8+") ➞ false

Notes

For clarity, each letter must have a plus sign on both sides.

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