the functional program elements in the eloquent javascript book can be used to develop a program without traditional looping and selection constructs the dataset of interest are a list of closed polygons represented by a list of their sides so for examp

Are you pressed for time and haven’t started working on your assignment yet? Would you like to buy an assignment? Use our custom writing services for better grades. Even if your deadline is approaching fast, our writers can handle your task right when you need it. Our writers will complete your order from scratch and make sure it’s completely unique.


Order a Similar Paper Order a Different Paper

Write a program in Javascript that exercises the functional higher order functions to compute the perimeter of only the triangles in the list. The program should be composed of the following elements.

  1. Embed a list of polygons into your program. The list must have a minimum of 5 polygons, with exactly 2 triangles in the list.
  2. Write a function named poly_sum(polygon) that returns the perimeter of the given polygon. So for example the rectangle [2,4,2,4] as input to this function would return 12, which is the sum of the 4 sides. Note that this function must be constructed only using the higher order functional elements outlined in the book. Use reduce to generate a sum of those sides.
  3. Use the standard filter function to generate a list of only the triangles in the original polygon list.
  4. Use the standard map function to compute the perimeters of the triangles from the previous step using poly_sum as the transformer.

Writerbay.net

Do you need help with this or a different assignment? Even when your task is complicated and the deadline is in less than 2 days, you still have every chance to get a good grade for it. How? By completing the order form, you will get the finest custom-written assignment at an affordable price. We also deliver a number of services for free (e.g., revisions, editing, checking the text for authenticity). Use our paper writing service to receive effective help with your homework.


Order a Similar Paper Order a Different Paper