Constants

Firefox gives no warning if you try to re-assign a const

This code tries to re-assign a constant:

const c = "a const"
c = "a new value";
dump(c);  // --> "a const"

As expected, c is unchanged, but no warning is issued in the JS Console (Tested with FF1.5, FF2 and GranParadiso/3.0a2 with javascript.options.strict = true). Since bug 103602 is marked fixed, I expect that it should give a warning.

At Nickolay's suggestion I asked if there any way to generate a warning if you mistakenly try to re-assign a const in mozilla.dev.tech.js-engine but so far there isn't an answer. Hamstersoup 08:00, 16 March 2007 (PDT)

Available only in C?

I'm pretty new to JavaScript, so this is just a note for wiser heads than mine.

The "What's new" page at the start of this document (http://developer.mozilla.org/en/docs....5_Guide:About) says, "Constants: Read only named constants are supported. This feature is available only in the C implementation of JavaScript."

The text here currently says nothing about being available only in C. One location or the other should be clarified.

Spooty

Same comment as on Talk:Core JavaScript 1.5 Guide:Creating New Objects:Defining Getters and Setters. --Nickolay 16:10, 24 October 2006 (PDT)