Guest User

Untitled

a guest
Jan 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.04 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. //Name: Kat Powell
  13. //--------------------------------------------------------------------------------
  14.  
  15. //--------------------------------------------------------------------------------
  16. //Exercise: Property Path Evaluation
  17. //--------------------------------------------------------------------------------
  18. function propertyValueAt (cars, propertyArrary){
  19.  
  20.  
  21.  
  22. var cars = { //created object with properties
  23. name: 'Honda',
  24. type: 'Sedan',
  25. var color = ['red', 'blue', 'green'];//added an array for color options
  26. };
  27.  
  28. console.log(propertyValue());
  29.  
  30.  
  31. //--------------------------------------------------------------------------------
  32. //Exercise: Sum Nested Arrays
  33. //--------------------------------------------------------------------------------
  34. var array = [1, 2, 3, 4];
  35.  
  36.  
  37. function sumNested () {
  38. for( i = 0; i < array.length; i++){
  39. console.log(array.length);
  40. };
  41.  
  42. console.log(sumNested);
  43.  
  44.  
  45. //--------------------------------------------------------------------------------
  46. //Exercise: Word Count
  47. //--------------------------------------------------------------------------------
  48.  
  49. function wordCount (sentence) {
  50.  
  51. if (sentence !== null && sentence !== ''){
  52. let wordArray = sentence.split('');
  53. return wordArray.length;
  54. } else {
  55. return 0;
  56. };
  57.  
  58. var sentence = 'This is a short sentence';
  59. console.log(sentence.length);
  60.  
  61.  
  62. //--------------------------------------------------------------------------------
  63. //Exercise: Anagram Tester
  64. //--------------------------------------------------------------------------------
  65.  
  66. var x = 'abc';
  67. var y = 'bcd';
  68. var z = 'cde';
  69.  
  70. function areTheseArguments () {
  71. if (x === y) {
  72. console.log('true');
  73. if (y === z) {
  74. console.log('false');
  75. if (x === z) {
  76. console.log('false');
  77. };
  78.  
  79.  
  80. //--------------------------------------------------------------------------------
  81. //Exercise: Analyze Prices- Didn't get to complete
  82. //--------------------------------------------------------------------------------
  83.  
  84. function analyzePrices
  85.  
  86. const object = {
  87. buyIndex:
  88. sellIndex:
  89.  
  90. };
  91.  
  92. //--------------------------------------------------------------------------------
  93. //Exercise: Fizz Buzz
  94. //--------------------------------------------------------------------------------
  95.  
  96. function fizzBuzz () {
  97.  
  98. for( n = 1; n <= 100; n++)
  99.  
  100. if( n % 3 === 0 && n % 5 ===0){
  101. console.log('fizzbuzz');
  102. } else if(n % 3 === 0) {
  103. console.log("fizz");
  104. } else if(i % 5 === 0) {
  105. console.log("buzz");
  106. } else (n <= 0) {
  107. console.log('empty string');
  108. } else ( n > 0) {
  109. console.log(n);
  110. }
  111.  
  112. };
  113.  
  114. console.log(fizzBuzz());
  115.  
  116.  
  117. //--------------------------------------------------------------------------------
  118. //Exercise: Object Oriented Programming - Car
  119. //--------------------------------------------------------------------------------
  120.  
  121. function car (){
  122.  
  123. function getSpeed(){
  124. this.speed >= 0;
  125. return this.speed;
  126. }
  127.  
  128. function setSpeed(){
  129. this.speed >= 0;
  130. return this.speed;
  131. }
  132.  
  133. function stop(){
  134. stop === 0;
  135. return stop;
  136. }
  137.  
  138. };
  139.  
  140. console.log(car.getSpeed());
  141.  
  142.  
  143. //--------------------------------------------------------------------------------
  144. //
  145. //--------------------------------------------------------------------------------
  146. </script>
  147.  
  148.  
  149.  
  150. <script id="jsbin-source-javascript" type="text/javascript">//--------------------------------------------------------------------------------
  151. //Name: Kat Powell
  152. //--------------------------------------------------------------------------------
  153.  
  154. //--------------------------------------------------------------------------------
  155. //Exercise: Property Path Evaluation
  156. //--------------------------------------------------------------------------------
  157. function propertyValueAt (cars, propertyArrary){
  158.  
  159.  
  160.  
  161. var cars = { //created object with properties
  162. name: 'Honda',
  163. type: 'Sedan',
  164. var color = ['red', 'blue', 'green'];//added an array for color options
  165. };
  166.  
  167. console.log(propertyValue());
  168.  
  169.  
  170. //--------------------------------------------------------------------------------
  171. //Exercise: Sum Nested Arrays
  172. //--------------------------------------------------------------------------------
  173. var array = [1, 2, 3, 4];
  174.  
  175.  
  176. function sumNested () {
  177. for( i = 0; i < array.length; i++){
  178. console.log(array.length);
  179. };
  180.  
  181. console.log(sumNested);
  182.  
  183.  
  184. //--------------------------------------------------------------------------------
  185. //Exercise: Word Count
  186. //--------------------------------------------------------------------------------
  187.  
  188. function wordCount (sentence) {
  189.  
  190. if (sentence !== null && sentence !== ''){
  191. let wordArray = sentence.split('');
  192. return wordArray.length;
  193. } else {
  194. return 0;
  195. };
  196.  
  197. var sentence = 'This is a short sentence';
  198. console.log(sentence.length);
  199.  
  200.  
  201. //--------------------------------------------------------------------------------
  202. //Exercise: Anagram Tester
  203. //--------------------------------------------------------------------------------
  204.  
  205. var x = 'abc';
  206. var y = 'bcd';
  207. var z = 'cde';
  208.  
  209. function areTheseArguments () {
  210. if (x === y) {
  211. console.log('true');
  212. if (y === z) {
  213. console.log('false');
  214. if (x === z) {
  215. console.log('false');
  216. };
  217.  
  218.  
  219. //--------------------------------------------------------------------------------
  220. //Exercise: Analyze Prices- Didn't get to complete
  221. //--------------------------------------------------------------------------------
  222.  
  223. function analyzePrices
  224.  
  225. const object = {
  226. buyIndex:
  227. sellIndex:
  228.  
  229. };
  230.  
  231. //--------------------------------------------------------------------------------
  232. //Exercise: Fizz Buzz
  233. //--------------------------------------------------------------------------------
  234.  
  235. function fizzBuzz () {
  236.  
  237. for( n = 1; n <= 100; n++)
  238.  
  239. if( n % 3 === 0 && n % 5 ===0){
  240. console.log('fizzbuzz');
  241. } else if(n % 3 === 0) {
  242. console.log("fizz");
  243. } else if(i % 5 === 0) {
  244. console.log("buzz");
  245. } else (n <= 0) {
  246. console.log('empty string');
  247. } else ( n > 0) {
  248. console.log(n);
  249. }
  250.  
  251. };
  252.  
  253. console.log(fizzBuzz());
  254.  
  255.  
  256. //--------------------------------------------------------------------------------
  257. //Exercise: Object Oriented Programming - Car
  258. //--------------------------------------------------------------------------------
  259.  
  260. function car (){
  261.  
  262. function getSpeed(){
  263. this.speed >= 0;
  264. return this.speed;
  265. }
  266.  
  267. function setSpeed(){
  268. this.speed >= 0;
  269. return this.speed;
  270. }
  271.  
  272. function stop(){
  273. stop === 0;
  274. return stop;
  275. }
  276.  
  277. };
  278.  
  279. console.log(car.getSpeed());
  280.  
  281.  
  282. //--------------------------------------------------------------------------------
  283. //
  284. //--------------------------------------------------------------------------------
  285.  
  286.  
  287.  
  288.  
  289. </script></body>
  290. </html>
Add Comment
Please, Sign In to add comment