Which way is faster when stripping part of string in JavaScript : <p>I need to strip part of JWT token and I am courious which one is faster, or less complex internally.</p>

<p>Example input string:</p>

<pre><code>const input = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjMsInR5cGUiOjAsImlhdCI6MTU4MTk3NDk1MCwiZXhwIjoxNTgxOTc4NTUwfQ.oEwxI51kVjB6jJUY2N5Ct6-hO0GUCUonolPbryUo-lI"
</code></pre>

<p>Which one of those methods is faster?</p>

<pre class="lang-js prettyprint-override"><code>const output =  input.split('.').slice(2,3).join('.');
</code></pre>

<pre class="lang-js prettyprint-override"><code>const output =  input.replace("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.","");
</code></pre>

<pre class="lang-js prettyprint-override"><code>const output =  //REGEX replace
</code></pre>

<p>I not found any informations about speeds of those methods and I am not exactly master in making tests :D</p>
