There are several versions to this problem related to the availability of items. In particular, the 01 version represents a situation where only one item of each type is available or can be selected. The unbounded case, which we consider here assumes that there are n types of items and that there are ifinitely many items of each type. The raw input data for this version consists then of the following:
So here is the formal picture:
z(U):= max { v_{1}x_{1} + v_{2}x_{2} + ... + v_{n}x_{n}} subject to: u_{1}x_{1} + u_{2}x_{2} + ... + u_{n}x_{n} <= U x_{1},...,x_{n} are nonnegative integers 
The volumes u_{1},...,u_{n} of the items as well as the total volume of the knapsack, U, are assumed to be nonnegative integers. Recall that, as indicated above, the "unbounded" version of the knapsack problem allows you to select as many items of each type as you wish, subject to the total volume constraint. The JavaScript code is a naive implementation of the following famous dynamic programming functional equation:

z(s) = max { v_{i} + z(s  u_{i}) : i = 1,2,...,n, u_{i}<=s} , u* <= s <=U z(s) = 0 , s < u*:= min {u_{i}: i=1,2,...,n} 