How to transform a string by selectively adding or removing characters using javascript
<p>I am struggling with the following problem:</p>

<p>Lets say I have a <strong>string</strong> <code>'foo.bar.baz'</code>. I want to transform it to <code>foo[bar][baz]</code></p>

<p>Is there a neat way to do this using JavaScript?</p>