const
定数を宣言します。定数として宣言すると以後、値の代入はできなくなります。constはNetscape 6以降、Mozilla、Firefoxでのみ使用できます。Opera 9ではエラーにはなりませんが、定数としては定義されず変数として定義されます。
構文
const 定数名
例文
<html> <head> <title>const</title> </head> <body> <script type="text/javascript"><!-- const a = 123; document.write(a+"<br>"); a = 456; document.write(a+"<br>"); // --></script> </body> </html>
関連記事
- with
- while
- var
- try
- throw
- this
- switch
- return
- new
- if
- function
- finally
- else
- do
- delete
- default
- continue
- catch
- case
- break
- Comment / コメント / 注釈
スポンサーリンク