// The global variable
var s = [23, 65, 98, 5];
Array.prototype.myFilter = function(callback){
// Only change code below this line
var newArray = [];
// Only change code above this line
return newArray;
};
var new_s = s.myFilter(function(item){
return item % 2 === 1;
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36.
Challenge: Implement the filter Method on a Prototype
Do remember, you can ask on the forum, if you have any issue understanding a challenge, or the code to pass the tests.
I will give you a hint:
Use a looping method to go through every element of the specific object called. If an element in the object matches the callback parameter (is true), then push the element to newArray.
i tried same with this functional programming and basic algorithm I don t understand them so no point to keep trying. Once I can see lot of examples than break them down understand them then i can try again.
magical girl I ve been thinking about javascript and just realized that you could add some tutorials on how to actually use javasript. You know in coding. It would help a lot to connect dots. Since on youtube channel there are only these challenges.
at this time there is not DOM manipulation with vanilla javascript
but the FrontEnd Frameworks and Libraries will teach about manipulating or creating the html and css