Guest User

Untitled

a guest
Nov 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.88 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: Jesse Kosydor
  13. //--------------------------------------------------
  14.  
  15. //--------------------------------------------------
  16. //Exercise: Property Path Evaluation
  17. //--------------------------------------------------
  18.  
  19. /*let object = {
  20.  
  21. }
  22.  
  23. const propertyValueAt = (object, array) =>{
  24.  
  25.  
  26. }*/
  27.  
  28. //--------------------------------------------------
  29. //Exercise: Sum Nested Arrays
  30. //--------------------------------------------------
  31.  
  32.  
  33.  
  34.  
  35. //--------------------------------------------------
  36. //Exercise: Word Count
  37. //--------------------------------------------------
  38.  
  39. /*let wordCount = sentence => {
  40.  
  41. str = sentence.split(" ");
  42.  
  43. return str.length
  44.  
  45. }
  46.  
  47. console.log(wordCount("Hello World!"))*/
  48.  
  49. //--------------------------------------------------
  50. //Exercise: Anagram Tester
  51. //--------------------------------------------------
  52.  
  53.  
  54. /*let areTheseAnagrams = (firstString, secondString) => {
  55.  
  56. let areStringsEqual;
  57.  
  58. let str1 = firstString.toLowerCase().split("").sort().join("");
  59. let str2 = secondString.toLowerCase().split("").sort().join("");
  60.  
  61. str1.toLowerCase();
  62. str2.toLowerCase();
  63. console.log(str1)
  64. console.log(str2)
  65.  
  66. if(str1 == str2){
  67. areStringsEqual = true;
  68. }else{
  69. areStringsEqual = false
  70. }
  71. return areStringsEqual
  72.  
  73. }
  74.  
  75. console.log(areTheseAnagrams("bad", "dba"));*/
  76.  
  77.  
  78.  
  79. //--------------------------------------------------
  80. //Exercise: Analyze Prices
  81. //--------------------------------------------------
  82.  
  83.  
  84. /*let analyzePrices = array => {
  85.  
  86. let maxValue;
  87. let minValue;
  88.  
  89. for(i = 0; i <= array.length; i++){
  90.  
  91. maxValue = Math.max.apply(null, array);
  92. minValue = Math.min.apply(null, array);
  93. }
  94.  
  95. let max = array[0];
  96. let maxIndex = 0;
  97. let min = array[0];
  98. let minIndex = 0
  99.  
  100. for (let i = 0; i < array.length; i++) {
  101. if (array[i] > max) {
  102. maxIndex = i;
  103. max = array[i];
  104. }
  105.  
  106. if(array[i] < min){
  107. minIndex = i;
  108. min = array[i];
  109. }
  110. }
  111. }
  112.  
  113. var prices = [1,2,3,4,5];
  114.  
  115. analyzePrices(prices)*/
  116.  
  117. //attempted to find the index with the the smallest number (minIndex) and then
  118. //the index with the largest number (maxIndex) and use those as the buy and sell properties
  119. //Had trouble making this work while also returning an object
  120.  
  121.  
  122.  
  123.  
  124. //--------------------------------------------------
  125. //Exercise: Fizz Buzz
  126. //--------------------------------------------------
  127.  
  128.  
  129. /* fizzBuzz = n => {
  130.  
  131. if(n < 0){
  132. return ""
  133. }
  134.  
  135. if(n > 0){
  136. for (var i = 1; i <= n; ++i) {
  137. if(i % 15 == 0){
  138. console.log("FizzBuzz");
  139. }
  140. else if (i % 3 == 0) {
  141. console.log("Fizz");
  142. } else if (i % 5 == 0) {
  143. console.log("Buzz");
  144. } else {
  145. console.log(i);
  146. }
  147. }
  148. }
  149. }
  150.  
  151. console.log(fizzBuzz(15))*/
  152.  
  153.  
  154.  
  155. //--------------------------------------------------
  156. //Exercise: Object Oriented Programming - Car
  157. //--------------------------------------------------
  158.  
  159. /*function Car(){
  160.  
  161. speed : 0,
  162.  
  163. get sp() {
  164. return this.speed;
  165. }
  166.  
  167. set speed(speed) {
  168. this.speed = speed;
  169. }
  170.  
  171. function stop(){
  172. speed = 0;
  173. }
  174.  
  175. }*/
  176.  
  177. //Was adding the methods to get. set and stop and ran out of time before I could have a
  178. //working constructor
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200. </script>
  201.  
  202.  
  203.  
  204. <script id="jsbin-source-javascript" type="text/javascript">//--------------------------------------------------
  205. //Name: Jesse Kosydor
  206. //--------------------------------------------------
  207.  
  208. //--------------------------------------------------
  209. //Exercise: Property Path Evaluation
  210. //--------------------------------------------------
  211.  
  212. /*let object = {
  213.  
  214. }
  215.  
  216. const propertyValueAt = (object, array) =>{
  217.  
  218.  
  219. }*/
  220.  
  221. //--------------------------------------------------
  222. //Exercise: Sum Nested Arrays
  223. //--------------------------------------------------
  224.  
  225.  
  226.  
  227.  
  228. //--------------------------------------------------
  229. //Exercise: Word Count
  230. //--------------------------------------------------
  231.  
  232. /*let wordCount = sentence => {
  233.  
  234. str = sentence.split(" ");
  235.  
  236. return str.length
  237.  
  238. }
  239.  
  240. console.log(wordCount("Hello World!"))*/
  241.  
  242. //--------------------------------------------------
  243. //Exercise: Anagram Tester
  244. //--------------------------------------------------
  245.  
  246.  
  247. /*let areTheseAnagrams = (firstString, secondString) => {
  248.  
  249. let areStringsEqual;
  250.  
  251. let str1 = firstString.toLowerCase().split("").sort().join("");
  252. let str2 = secondString.toLowerCase().split("").sort().join("");
  253.  
  254. str1.toLowerCase();
  255. str2.toLowerCase();
  256. console.log(str1)
  257. console.log(str2)
  258.  
  259. if(str1 == str2){
  260. areStringsEqual = true;
  261. }else{
  262. areStringsEqual = false
  263. }
  264. return areStringsEqual
  265.  
  266. }
  267.  
  268. console.log(areTheseAnagrams("bad", "dba"));*/
  269.  
  270.  
  271.  
  272. //--------------------------------------------------
  273. //Exercise: Analyze Prices
  274. //--------------------------------------------------
  275.  
  276.  
  277. /*let analyzePrices = array => {
  278.  
  279. let maxValue;
  280. let minValue;
  281.  
  282. for(i = 0; i <= array.length; i++){
  283.  
  284. maxValue = Math.max.apply(null, array);
  285. minValue = Math.min.apply(null, array);
  286. }
  287.  
  288. let max = array[0];
  289. let maxIndex = 0;
  290. let min = array[0];
  291. let minIndex = 0
  292.  
  293. for (let i = 0; i < array.length; i++) {
  294. if (array[i] > max) {
  295. maxIndex = i;
  296. max = array[i];
  297. }
  298.  
  299. if(array[i] < min){
  300. minIndex = i;
  301. min = array[i];
  302. }
  303. }
  304. }
  305.  
  306. var prices = [1,2,3,4,5];
  307.  
  308. analyzePrices(prices)*/
  309.  
  310. //attempted to find the index with the the smallest number (minIndex) and then
  311. //the index with the largest number (maxIndex) and use those as the buy and sell properties
  312. //Had trouble making this work while also returning an object
  313.  
  314.  
  315.  
  316.  
  317. //--------------------------------------------------
  318. //Exercise: Fizz Buzz
  319. //--------------------------------------------------
  320.  
  321.  
  322. /* fizzBuzz = n => {
  323.  
  324. if(n < 0){
  325. return ""
  326. }
  327.  
  328. if(n > 0){
  329. for (var i = 1; i <= n; ++i) {
  330. if(i % 15 == 0){
  331. console.log("FizzBuzz");
  332. }
  333. else if (i % 3 == 0) {
  334. console.log("Fizz");
  335. } else if (i % 5 == 0) {
  336. console.log("Buzz");
  337. } else {
  338. console.log(i);
  339. }
  340. }
  341. }
  342. }
  343.  
  344. console.log(fizzBuzz(15))*/
  345.  
  346.  
  347.  
  348. //--------------------------------------------------
  349. //Exercise: Object Oriented Programming - Car
  350. //--------------------------------------------------
  351.  
  352. /*function Car(){
  353.  
  354. speed : 0,
  355.  
  356. get sp() {
  357. return this.speed;
  358. }
  359.  
  360. set speed(speed) {
  361. this.speed = speed;
  362. }
  363.  
  364. function stop(){
  365. speed = 0;
  366. }
  367.  
  368. }*/
  369.  
  370. //Was adding the methods to get. set and stop and ran out of time before I could have a
  371. //working constructor
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392. </script></body>
  393. </html>
Add Comment
Please, Sign In to add comment