In Javascript, why are \b characters dropped in a .join()?
<p>In Javascript, why does this statement not equal <code>'\b,\b'</code>?</p><pre><br /><code>['\b', '\b'].join()<br />//=> ","<br /></code><br /></pre><p>According to MDN docs on <code>join</code>:</p><blockquote><p>If an element is undefined or null, it is converted to the empty string.</p></blockquote><p>So why is <code>\b</code> being evaluated as undefined/null?</p><p>Additionally, the<code>\b</code> is dropped from any string prepended with it, e.g:</p><pre><br /><code>['\btest', '\btest2'].join()<br />//=> "test,test2"<br /></code><br /></pre><p>Something crazy is going on.</p><br /><h2>Click here view more answers <a href="http://ift.tt/1VAVgfo">http://ift.tt/1VAVgfo</a></h2>
Nhận xét
Đăng nhận xét