Guest User

Untitled

a guest
Jan 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 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.  
  12.  
  13. //--------------------------------
  14. //Name: Eric Schroeter
  15. //--------------------------------
  16.  
  17. //-------------------------------
  18. // Exercise: Property Path Evaluation
  19. //-------------------------------
  20.  
  21.  
  22.  
  23.  
  24. //--------------------------
  25. // Exercise: Sum Nested Arrays
  26. //--------------------------
  27.  
  28. let list = [0,1,2,3,4,5,6,7,8,9,10];
  29. let count = 0;
  30. let numHoldOne = 0;
  31. let numHoldTwo = 0;
  32. let total = 0;
  33.  
  34.  
  35.  
  36. function sumNested(object) {
  37. while (count < object.length) {
  38. numHoldOne = object[count];
  39. console.log(object[count]);
  40. numHoldTwo = numHoldOne;
  41. total = total + numHoldTwo;
  42. count++;
  43.  
  44. }
  45. }
  46.  
  47. //console.log(list.length);
  48. console.log(sumNested(list));
  49.  
  50.  
  51. //---------------------------
  52. // Exercise: Word Count
  53. //---------------------------
  54.  
  55. let abc = 'The dog is walking down the street';
  56.  
  57. function wordCount(string) {
  58.  
  59. }
  60.  
  61.  
  62. //-----------------------------
  63. // Exercise: Anagram Tester
  64. //----------------------------
  65.  
  66. let one = 'abc';
  67. let two = 'bca';
  68. let three = 'cde';
  69. let stringOneLength = stringOne.length;
  70. let stringTwoLength = stringTwo.length;
  71.  
  72. //compare each character in the first string to the other characters in the second string
  73. function areTheseAnagrams(stringOne, stringTwo) {
  74. if (stringOneLength !== stringTwoLength) {
  75. return 'False'
  76. } else {
  77. for (let count = 0; count < stringOneLength && count < stringTwoLength; count ++) {
  78. if(stringOne.charAt(count) === stringTwo.charAt(count)) {
  79. return 'True'
  80. } else break;
  81. }
  82. }
  83. }
  84.  
  85.  
  86. </script>
  87.  
  88.  
  89.  
  90. <script id="jsbin-source-javascript" type="text/javascript">
  91.  
  92. //--------------------------------
  93. //Name: Eric Schroeter
  94. //--------------------------------
  95.  
  96. //-------------------------------
  97. // Exercise: Property Path Evaluation
  98. //-------------------------------
  99.  
  100.  
  101.  
  102.  
  103. //--------------------------
  104. // Exercise: Sum Nested Arrays
  105. //--------------------------
  106.  
  107. let list = [0,1,2,3,4,5,6,7,8,9,10];
  108. let count = 0;
  109. let numHoldOne = 0;
  110. let numHoldTwo = 0;
  111. let total = 0;
  112.  
  113.  
  114.  
  115. function sumNested(object) {
  116. while (count < object.length) {
  117. numHoldOne = object[count];
  118. console.log(object[count]);
  119. numHoldTwo = numHoldOne;
  120. total = total + numHoldTwo;
  121. count++;
  122.  
  123. }
  124. }
  125.  
  126. //console.log(list.length);
  127. console.log(sumNested(list));
  128.  
  129.  
  130. //---------------------------
  131. // Exercise: Word Count
  132. //---------------------------
  133.  
  134. let abc = 'The dog is walking down the street';
  135.  
  136. function wordCount(string) {
  137.  
  138. }
  139.  
  140.  
  141. //-----------------------------
  142. // Exercise: Anagram Tester
  143. //----------------------------
  144.  
  145. let one = 'abc';
  146. let two = 'bca';
  147. let three = 'cde';
  148. let stringOneLength = stringOne.length;
  149. let stringTwoLength = stringTwo.length;
  150.  
  151. //compare each character in the first string to the other characters in the second string
  152. function areTheseAnagrams(stringOne, stringTwo) {
  153. if (stringOneLength !== stringTwoLength) {
  154. return 'False'
  155. } else {
  156. for (let count = 0; count < stringOneLength && count < stringTwoLength; count ++) {
  157. if(stringOne.charAt(count) === stringTwo.charAt(count)) {
  158. return 'True'
  159. } else break;
  160. }
  161. }
  162. }
  163.  
  164. </script></body>
  165. </html>
Add Comment
Please, Sign In to add comment