var allCourses = new Array();var coursesId = new Array();function findCourses() { Courses.data().each(function (value, index) { if (CoursesId.indexOf(value.id) == -1) { coursesId.push(value.id) allcourses.push(value); } });}