String

formatting

Compare the list formatting between the properties and methods section: which one do you think looks better? --Maian 03:57, 16 September 2005 (PDT)

We seem to prefer the dd/dt variant (as in methods) for the DOM reference and in some other places, but I personally like the former variant for its conciseness, or maybe
  • constructor: Specifies the function that creates an object's prototype.
  • length: Reflects the length of the string.
  • prototype: Allows the addition of properties to a String object.

(this takes even less vertical place) --Nickolay 05:15, 16 September 2005 (PDT)

Setting numeric properties on String object

Setting a character in the array-like way does not throw an error, but the string itself is unchanged. The property corresponding to the index does change, but the change is not reflected in the original string

Doesn't work for me in JS Shell, Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051007 Firefox/1.4.1

var x = 'cat';
x[2] = 'r';
alert(x[2]); // actually outputs 't', not 'r'

Not sure what should happen here. --Nickolay 14:28, 11 October 2005 (PDT)

Strange, it outputs 't' here as well, though I was sure it outputted 'r' when I tried it yesterday. Or maybe my eyes were too tired :p I'll update that section, until I can verify whether or not it does change. --Maian 20:20, 11 October 2005 (PDT)

Heading for "Methods unrelated to HTML"

I'd like to rename "Methods unrelated to HTML" to "General purpose methods" or something like that. Is this likely to cause a problem with incoming links? --Deltab 06:55, 9 March 2006 (PST)

I think that's ok. You could add an element with id="Methods_unrelated_to_HTML" if you care. Note that the page will be reorganized anyway: Sandbox:JS:String --Nickolay 07:04, 9 March 2006 (PST)

Too many Strings

I have used the Global Objects: String page many times. Now there is a new page that overlaps it called String Object. I'm not sure what is going on with that, but I urge writers of these docs to keep the simple stuff at the top of the page and obscure gotchas at the bottom. I moved the discussion of literals vs objects on the String Object page to the bottom; I think the same should be done here.

There is (and always have been) the JS Guide accompanying the Reference. Both were migrated from the devedge site and I don't think the original authors contribute to MDC. --Nickolay 11:15, 4 November 2006 (PST)

This page uses the term "literal" incorrectly I believe. A sequence of characters enclosed in quotes is a string literal, but the Javascript thing created by the interpreter when this sequence is analyzed is a string primitive. (Short for "object of primitive datatype"). The literal is just the kind of token in the source, not the kind of object in the runtime. Javascript has no datatype "string literal"; it has two string datatypes, primitive string and primitive object with String properties.

--JohnJBarton 08:49, 4 November 2006 (PST)

I think you're right, please fix the page. --Nickolay 11:15, 4 November 2006 (PST)

done --JohnJBarton 19:52, 5 November 2006 (PST)

Thank you! --Nickolay 04:20, 6 November 2006 (PST)

Document Tags and Contributors

Contributors to this page: Nickolay, JohnJBarton1, Deltab, Maian
Last updated by: Nickolay,