We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS


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)

I sympathize with the desire, but I don't think it's that huge a deal in practice. I don't think a beginning web developer is likely to assume a print() function is defined; also, it's not a huge jump to do something like var print = alert; to make the examples work. Also, the use of print is reasonably standard -- Perl, Python, and PHP all have a construct named print that does basically what's done by the hypothetical print function used here -- so I don't see a huge gain from switching to something else. --Waldo 12:33, 18 March 2007 (PDT)
Thanks for reply. I understand your idea, and I might think too much, so I don't change print to other name. -- Potappo 06:02, 19 March 2007 (PDT)

Describing substr() vs. substring() vs. slice() more comprehensively

It seems to me that the wiki should describe the relationship and similarities between these three string methods, along with advice on which to use when. I think that would involve deprecating or discouraging use of substring(). H3h 15 September 2008

Document Tags and Contributors

Contributors to this page: H3h, Potappo, Waldo
Last updated by: H3h,