проверка





js/script.js
  • var Obj = {
  •  val: 10,
  •  str: 'Hello World!'
  • }
  •  
  • delete Obj.val;
  •  
  • function funMake() {
  •  if('val' in Obj) {
  •   document.write(Obj.val + '<br />');
  •  }
  •  else {
  •   document.write('Error<br />');
  •  }
  •  if('str' in Obj) {
  •   document.write(Obj.str + '<br />');
  •  }
  •  else {
  •   document.write('Error<br />');
  •  }
  •  if('a' in Obj) {
  •   document.write(Obj.a + '<br />');
  •  }
  •  else {
  •   document.write('Error<br />');
  •  }
  • }
var Obj = {
 val: 10, 
 str: 'Hello World!'
}

delete Obj.val;

function funMake() {
 if('val' in Obj) {
  document.write(Obj.val + '
'); } else { document.write('Error
'); } if('str' in Obj) { document.write(Obj.str + '
'); } else { document.write('Error
'); } if('a' in Obj) { document.write(Obj.a + '
'); } else { document.write('Error
'); } }


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>