3_fields_check.js 565 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. let a = {
  2. name: 'Sergey',
  3. surname: 'Honcharenko',
  4. age: 28,
  5. isMarried: false,
  6. }
  7. let b = {
  8. name: 'Andrew',
  9. surname: 'Klymchuk',
  10. middleName: 'Anatoliyovych',
  11. haveAJob: true,
  12. }
  13. let c = {
  14. name: 'Alexander',
  15. surname: 'Slobodian',
  16. sex: 'male',
  17. hasAPet: false,
  18. }
  19. if('age' in a) {
  20. alert('age');
  21. }
  22. if('isMarried' in a) {
  23. alert('isMarried');
  24. }
  25. if('middleName' in b) {
  26. alert('middleName');
  27. }
  28. if('haveAJob' in b) {
  29. alert('haveAJob');
  30. }
  31. if('sex' in c) {
  32. alert('sex');
  33. }
  34. if('hasAPet' in c) {
  35. alert('hasAPet');
  36. }