Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 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. /*Data types
  12. *
  13. *There are simple and complex data types.
  14. *
  15. *Simple data types do not hold, collect, or aggregate other values.
  16. *
  17. *Numbers are numeric data.
  18. *Strings are character data.
  19. *Booleans are binary data, represented as true or false.
  20. *NaN is not a number. When operations are performed on undefined variables,
  21. * we get this falsey data type.
  22. *Undefined means that a variable has been declared, but has not been given
  23. * a value.
  24. *Null means no value. The old value has been nullified by a programmer.
  25. *Infinity represents mathematical infinity.
  26. *
  27. * Operators on primitives return new primitives: */
  28.  
  29. var numberFive = 5;
  30. console.log(numberFive + 6);
  31.  
  32. /*Complex data types are objects, arrays, and functions. Objects can
  33. * contain any number of key:value pairs. Arrays can contain any number of
  34. * elements. Functions can encapsulate any number of statements. */
  35.  
  36. // Objects
  37.  
  38. var myObject = {
  39. key1: "value1",
  40. key2: "value2",
  41. key3: "value3"
  42. }
  43.  
  44. // Objects can be modified elsewhere in code.
  45.  
  46. myObject.key4 = "value4";
  47. console.log(myObject);
  48.  
  49. // Arrays are zero-indexed lists of data types.
  50.  
  51. var myArray = ["value1", "value2", "value3"];
  52.  
  53. // Arrays can also be modified elsewhere in code.
  54.  
  55. myArray.push("value4");
  56. console.log(myArray);
  57.  
  58. // Functions are reusable blocks of code which perform operations when invoked.
  59.  
  60. function myFunction(a, b) {
  61. console.log(a + " " + b);
  62. }
  63.  
  64. // Invocations
  65.  
  66. var firstName = "Mario";
  67. var lastName = "the Plumber";
  68. myFunction(firstName, lastName);
  69. </script>
  70.  
  71.  
  72.  
  73. <script id="jsbin-source-javascript" type="text/javascript">/*Data types
  74. *
  75. *There are simple and complex data types.
  76. *
  77. *Simple data types do not hold, collect, or aggregate other values.
  78. *
  79. *Numbers are numeric data.
  80. *Strings are character data.
  81. *Booleans are binary data, represented as true or false.
  82. *NaN is not a number. When operations are performed on undefined variables,
  83. * we get this falsey data type.
  84. *Undefined means that a variable has been declared, but has not been given
  85. * a value.
  86. *Null means no value. The old value has been nullified by a programmer.
  87. *Infinity represents mathematical infinity.
  88. *
  89. * Operators on primitives return new primitives: */
  90.  
  91. var numberFive = 5;
  92. console.log(numberFive + 6);
  93.  
  94. /*Complex data types are objects, arrays, and functions. Objects can
  95. * contain any number of key:value pairs. Arrays can contain any number of
  96. * elements. Functions can encapsulate any number of statements. */
  97.  
  98. // Objects
  99.  
  100. var myObject = {
  101. key1: "value1",
  102. key2: "value2",
  103. key3: "value3"
  104. }
  105.  
  106. // Objects can be modified elsewhere in code.
  107.  
  108. myObject.key4 = "value4";
  109. console.log(myObject);
  110.  
  111. // Arrays are zero-indexed lists of data types.
  112.  
  113. var myArray = ["value1", "value2", "value3"];
  114.  
  115. // Arrays can also be modified elsewhere in code.
  116.  
  117. myArray.push("value4");
  118. console.log(myArray);
  119.  
  120. // Functions are reusable blocks of code which perform operations when invoked.
  121.  
  122. function myFunction(a, b) {
  123. console.log(a + " " + b);
  124. }
  125.  
  126. // Invocations
  127.  
  128. var firstName = "Mario";
  129. var lastName = "the Plumber";
  130. myFunction(firstName, lastName);
  131.  
  132. </script></body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement