Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. /****Homework Assignment #3: Statements and Operators
  12. //Details:
  13. Let's look at a popular logical argument (a syllogism)
  14.  
  15. All men are mortal
  16. Socrates is a man.
  17. Therefore, socrates is mortal.
  18.  
  19. Using "if statements" and any other logical operators and data-types
  20. you see fit, recreate this logical argument.
  21. Your code should make clear that "socrates" is part of a collection of items referred to as "men", and that all members of this collection are mortal. You should also then demonstrate that since Socrates is part of this collection, it follows that he is mortal as well.
  22. Extra Credit:
  23.  
  24. Got the hang of creating a logical argument? Want to try another one? Try this one as well:
  25.  
  26. This cake is either vanilla or chocolate.
  27. This cake is not chocolate.
  28. Therefore, this cake is vanilla.
  29. ****/
  30.  
  31. "use strict";
  32.  
  33. var objectMen = {
  34. man1: "Johnson",
  35. man2: "paul",
  36. man3: "socrate"
  37. };
  38. console.log(objectMen);
  39. console.log(objectMen.man3);
  40.  
  41. var socrate = "Socrate";
  42. var allMenAreMortal = true;
  43. var SocrateIsAMen = true;
  44. var SocrateIsMortal = true;
  45.  
  46. if (SocrateIsAMen === SocrateIsMortal) {
  47. console.log('All men are mortal');
  48. console.log('Socrate is a man');
  49. console.log('Socrate is mortal');
  50. } else if (socrate === SocrateIsMortal) {
  51. console.log('All men are mortal');
  52. console.log('Socrate is not man');
  53. } else {
  54. console.log('All men are not mortal');
  55. console.log('Socrate is not a man');
  56. console.log('Socrate is not mortal');
  57. }
  58.  
  59. var Vanilla = true;
  60. var Chocolate = true;
  61.  
  62. if (Vanilla || isChocolate) {
  63. console.log('This cake is either vanilla or chocolate');
  64. if (Chocolate === true) {
  65. console.log('This cake is not chocolate');
  66. console.log('Therefore,this cake is vanilla');
  67. }
  68. }
  69. </script>
  70.  
  71.  
  72.  
  73. <script id="jsbin-source-javascript" type="text/javascript">/****Homework Assignment #3: Statements and Operators
  74. //Details:
  75. Let's look at a popular logical argument (a syllogism)
  76.  
  77. All men are mortal
  78. Socrates is a man.
  79. Therefore, socrates is mortal.
  80.  
  81. Using "if statements" and any other logical operators and data-types
  82. you see fit, recreate this logical argument.
  83. Your code should make clear that "socrates" is part of a collection of items referred to as "men", and that all members of this collection are mortal. You should also then demonstrate that since Socrates is part of this collection, it follows that he is mortal as well.
  84. Extra Credit:
  85.  
  86. Got the hang of creating a logical argument? Want to try another one? Try this one as well:
  87.  
  88. This cake is either vanilla or chocolate.
  89. This cake is not chocolate.
  90. Therefore, this cake is vanilla.
  91. ****/
  92.  
  93.  
  94. var objectMen =
  95. {
  96. man1: "Johnson",
  97. man2: "paul",
  98. man3: "socrate",
  99. }
  100. console.log(objectMen)
  101. console.log(objectMen.man3);
  102.  
  103. var socrate = "Socrate";
  104. var allMenAreMortal = true;
  105. var SocrateIsAMen = true;
  106. var SocrateIsMortal = true;
  107.  
  108. if(SocrateIsAMen === SocrateIsMortal)
  109. {
  110. console.log('All men are mortal');
  111. console.log('Socrate is a man');
  112. console.log('Socrate is mortal');
  113.  
  114. }
  115.  
  116. else if(socrate === SocrateIsMortal )
  117. {
  118. console.log('All men are mortal');
  119. console.log('Socrate is not man');
  120. }
  121. else
  122. {
  123. console.log('All men are not mortal');
  124. console.log('Socrate is not a man');
  125. console.log('Socrate is not mortal');
  126. }
  127.  
  128. const Vanilla = true;
  129. const Chocolate = true;
  130.  
  131. if(Vanilla || isChocolate)
  132. {
  133. console.log('This cake is either vanilla or chocolate');
  134. if
  135. (Chocolate === true)
  136. {
  137. console.log('This cake is not chocolate');
  138. console.log('Therefore,this cake is vanilla');
  139. }
  140. }
  141.  
  142. </script></body>
  143. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement