Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. listFilter = () => {
  2. let newList = [];
  3. let search = this.state.search;
  4. let list = this.state.filteredStudents;
  5. if (this.state.search !== "") {
  6. for (let i = 0; i > list.length; i++) {
  7. let checkFirst = list[i].firstName.includes(search);
  8. let checkLast = list[i].lastName.includes(search);
  9. if (checkFirst === true || checkLast === true) {
  10. console.log("this is list i : " + list[i]);
  11. }
  12. }
  13. this.setState({ filteredStudents: newList });
  14. } else {
  15. let resetStudents = this.state.students;
  16. this.setState({ filteredStudents: resetStudents });
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement