определение и инициализация





index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  • </head>
  • <body>
  • <script>
  •  //a definition
  •  var val0;
  •  //an initialization
  •  val0 = 5;
  •  document.write(val0 + '<br />');
  •  //a definition and an initialization
  •  var val1 = 10;
  •  document.write(val1 + '<br />');
  •  //a definition and a dynamic initialization
  •  var val2 = val0 + val1;
  •  document.write(val2 + '<br />');
  •  //a definition and an initialization with the constructor
  •  var val3 = new Number(20);
  •  document.write(val3 + '<br />');
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  • </head>
  • <body>
  • <script>
  •  //a definition
  •  var val0;
  •  //an initialization
  •  val0 = 5;
  •  document.write(val0 + '<br />');
  •  //a definition and an initialization
  •  var val1 = 10;
  •  document.write(val1 + '<br />');
  •  //a definition and a dynamic initialization
  •  var val2 = val0 + val1;
  •  document.write(val2 + '<br />');
  •  //a definition and an initialization with the constructor
  •  var val3 = new Number(20);
  •  document.write(val3 + '<br />');
  • </script>
  • </body>
  • </html>