mozilla

Revision 143995 of substr

  • Revision slug: Talk:JavaScript/Reference/Global_Objects/String/substr
  • Revision title: substr
  • Revision id: 143995
  • Created:
  • Creator: Potappo
  • Is current revision? No
  • Comment Should <code>print</code> change to other name?

Revision Content

Should print change to other name?

Because print conflicts with window.print in some browsers, should print change to other name? The following code is a example.:

//assumes a echo function is defined.
var str = "abcdefghij";
echo("(1,2): "    + str.substr(1,2));
echo("(-2,2): "   + str.substr(-2,2));
echo("(1): "      + str.substr(1));
echo("(-20, 2): " + str.substr(-20,2));
echo("(20, 2): "  + str.substr(20,2));

--Potappo 04:39, 16 March 2007 (PDT)

Revision Source

<h3 name="Should_print_change_to_other_name.3F"> Should <code>print</code> change to other name? </h3>
<p>Because <code>print</code> conflicts with <a href="en/DOM/window.print"><code>window.print</code></a> in some browsers, should <code>print</code> change to other name? The following code is a example.:
</p>
<pre class="eval">//assumes a echo function is defined.
var str = "abcdefghij";
echo("(1,2): "    + str.substr(1,2));
echo("(-2,2): "   + str.substr(-2,2));
echo("(1): "      + str.substr(1));
echo("(-20, 2): " + str.substr(-20,2));
echo("(20, 2): "  + str.substr(20,2));
</pre>
<p>--<a href="User:Potappo">Potappo</a> 04:39, 16 March 2007 (PDT)
</p>
Revert to this revision