конкатенация





js/script.js
  • var str0 = 'Hello';
  • var str1 = ' ';
  • var str2 = 'World';
  • var str3 = '!';
  • var res = str0 + str1 + str2 + str3;
  •  
  • function funMake() {
  •  document.write(res + '<br />');
  • }
var str0 = 'Hello';
var str1 = ' ';
var str2 = 'World';
var str3 = '!';
var res = str0 + str1 + str2 + str3;

function funMake() {
 document.write(res + '
'); }


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>