• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Constants

As you can tell from the name “variable,” the value in variables can change. However, you might not want the value in a variable to change—for example, you might want to store the value of pi, 3.1415926, for easy access throughout your script. Pi’s not going to change; if you store it in a variable, however, you run the risk that its value might be inadvertently changed somewhere in your script. The Netscape Navigator version 6 enables you to declare constants instead, using the const statement, which you see in Table 2.2. Once declared, a constant can’t change its value.

Table 2.2. The const Statement
Statement NS2 NS3 NS4 NS6 IE3a IE3b IE4 IE5 IE5.5 IE6
const    x      



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint