There are a number of functions in
ko.utils. Let's start by looking at the special array methods in standard Knockout.
ko.utils.arrayFilter function allows us to filter items in an array. We are going to run these as straight code examples. We will create a sample JSON file and load it via AJAX to keep the focus on learning the methods and not waste time creating an example code set. We will create a page called
utility.html for these pieces of code and run the filtering code from there. Our markup for this example is here:
<h3>arrayFilter() : staff under 35</h3> <ul data-bind="foreach: youngStaff"> <li><span data-bind="text: age() + ' ' + firstName()"></span></li> </ul>
script code is as follows. We ...