Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="description" content="DataTypes">
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <title>JS Bin</title>
  8. </head>
  9. <body>
  10.  
  11. <script id="jsbin-javascript">
  12. /*
  13. DATA TYPES.
  14.  
  15. Data Types are the key information that we feed our programs. They give us
  16. the ability to describe real-world objects and solve real-world problems.
  17. JS Data Types are Dynamic which means that the same variable can be used to
  18. hold different Data Types.
  19.  
  20. SIMPLE/Primitive Data Types that are used/manipulated are:
  21.  
  22. Numbers = Numerical Data
  23. Strings = Character-based Data
  24. Booleans = Evaluate to TRUE/FALSE
  25. NaN = 'Not a Number'
  26. undefined = No-value, Unassigned. Any variable can be emptied or undefined
  27. null = No-value, Nothing. Any object can be emptied & assigned to null
  28. Infinity = property of the global object whose numeric value = infinity
  29. *These Data Types are immutable. They copy by Value.
  30.  
  31.  
  32. COMPLEX Data Types are collections of simple Data Types:
  33.  
  34. Arrays = single variables with multiple values aka objects with values
  35. referenced by number or indices
  36.  
  37. Objects = complex collections of properties aka key-value pairs. These
  38. key-value pairs are referenced rather than numbered indices
  39.  
  40. Functions = blocks of code designed to perform particular tasks. Functions
  41. manipulate all data types and collections to give life & purpose to our programs.
  42. *These Data Types are mutable. They hold value by reference
  43.  
  44.  
  45. DATA TYPES EX: interplay between protagonist/antagonist from my fav anime(=
  46. */
  47.  
  48. nameGivenToLight = true;
  49. seenLight = true;
  50.  
  51. let protagonist = {
  52. name: 'Light Yagami',
  53. alias: 'Kira',
  54. anime: 'Death Note',
  55. shinigami: false,
  56. killMethod: function() {
  57. if(nameGivenToLight === true && seenLight === true) {
  58. var status = "Now " + antagonist.alias + " is dead.";
  59. console.log(status);
  60. } else {
  61. Console.log("Still breathing");
  62. }
  63. }
  64. };
  65.  
  66. let antagonist = {
  67. name: 'L. Lawliet',
  68. alias: 'L',
  69. anime: 'Death Note',
  70. shinigami: false
  71. };
  72.  
  73. protagonist.killMethod(); //Logs "Now L is dead."
  74. </script>
  75.  
  76.  
  77.  
  78. <script id="jsbin-source-javascript" type="text/javascript">/*
  79. DATA TYPES.
  80.  
  81. Data Types are the key information that we feed our programs. They give us
  82. the ability to describe real-world objects and solve real-world problems.
  83. JS Data Types are Dynamic which means that the same variable can be used to
  84. hold different Data Types.
  85.  
  86. SIMPLE/Primitive Data Types that are used/manipulated are:
  87.  
  88. Numbers = Numerical Data
  89. Strings = Character-based Data
  90. Booleans = Evaluate to TRUE/FALSE
  91. NaN = 'Not a Number'
  92. undefined = No-value, Unassigned. Any variable can be emptied or undefined
  93. null = No-value, Nothing. Any object can be emptied & assigned to null
  94. Infinity = property of the global object whose numeric value = infinity
  95. *These Data Types are immutable. They copy by Value.
  96.  
  97.  
  98. COMPLEX Data Types are collections of simple Data Types:
  99.  
  100. Arrays = single variables with multiple values aka objects with values
  101. referenced by number or indices
  102.  
  103. Objects = complex collections of properties aka key-value pairs. These
  104. key-value pairs are referenced rather than numbered indices
  105.  
  106. Functions = blocks of code designed to perform particular tasks. Functions
  107. manipulate all data types and collections to give life & purpose to our programs.
  108. *These Data Types are mutable. They hold value by reference
  109.  
  110.  
  111. DATA TYPES EX: interplay between protagonist/antagonist from my fav anime(=
  112. */
  113.  
  114. nameGivenToLight = true;
  115. seenLight = true;
  116.  
  117. let protagonist = {
  118. name: 'Light Yagami',
  119. alias: 'Kira',
  120. anime: 'Death Note',
  121. shinigami: false,
  122. killMethod: function() {
  123. if(nameGivenToLight === true && seenLight === true) {
  124. var status = "Now " + antagonist.alias + " is dead.";
  125. console.log(status);
  126. } else {
  127. Console.log("Still breathing");
  128. }
  129. }
  130. };
  131.  
  132. let antagonist = {
  133. name: 'L. Lawliet',
  134. alias: 'L',
  135. anime: 'Death Note',
  136. shinigami: false
  137. };
  138.  
  139. protagonist.killMethod(); //Logs "Now L is dead."
  140. </script></body>
  141. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement