Functinal programming

please help me with the code.

my source code:
const squaredList = arr  =>
arr
.filter(i => i > 0 && i % parseInt(i)===0)
.map(i =>  math.pow(i, 2));
return arr;

here is the  link to the challenge https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem'

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem

What problems are you having? What are the different things you have tried? What part is confusing you? What is behaving differently than you expect it to?

The built in Math object is case sensitive.
If you’ve done the previous lessons, you should also know if the array functions you’ve utilized mutate the array or not, and how that relates to your return value.

hi @ArielLeslie the last two lines in the challenge are not passing

Solution
const squareList = (arr) => {
  	.filter(i => i > 0 && i % parseInt(i)===0)
	.map(i =>  math.pow(i, 2));
return arr;
	const squaredIntegers = squareList(arr);
	console.log(squaredIntegers);
};

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

1 Like