Question
Problem 05: getObservationsByPositionalAccuracy() * * Write a function that filters observations according to their positional * accuracy. iNaturalist allows users to give an accuracy level
Problem 05: getObservationsByPositionalAccuracy() * * Write a function that filters observations according to their positional * accuracy. iNaturalist allows users to give an accuracy level in meters for * the location. * * Your function should accept iNaturalist data, and an options Object, which * may contain various filtering options. The return value is an Array of * observations, whose positional_accuracy value matches the options provided. * For example: * * getObservationsByPositionalAccuracy(data, { equal: 135 }) means only return * observations whose positional_accuracy is exactly equal to 135. * * getObservationsByPositionalAccuracy(data, { greaterThan: 35 }) means only return * observations whose positional_accuracy is greater than 35. * * getObservationsByPositionalAccuracy(data, { lessThan: 1035 }) means only return * observations whose positional_accuracy is less than 1035. * * getObservationsByPositionalAccuracy(data, { greaterThan: 35, lessThan: 1035 }) * means only return observations whose positional_accuracy is greater than 35 * AND less than 1035. * * If no options object is given, or none of the expect values are present (i.e. * equal, greaterThan, lessThan), then return all values. If all of equal, * greaterThan, and lessThan are given, prefer equal (i.e., ignore the other two). * * Use the Array .filter() method in your solution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started