Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is what I have tried. The final output result is showing undefined
- const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
- const squareList = function(arr) {
- "use strict";
- const squaredIntegers = function(num) {
- (function() {
- arr.filter(Number.isInteger(num) && num > 0);
- });
- return squaredIntegers;
- }
- }
- const squaredIntegers = squareList(realNumberArray);
- console.log(squaredIntegers);
- //Here is the Arrow function I was trying to convert
- const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2];
- const squareList = (arr) => {
- "use strict";
- const squaredIntegers = arr.filter(num => Number.isInteger(num) && num > 0);
- return squaredIntegers;
- };
- const squaredIntegers = squareList(realNumberArray);
- console.log(squaredIntegers);
- //The code should output this
- [4, 42, 6];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement