function filterUsers() {
      let inputValue = this.value;

      if (inputValue !== '') {

        clearUsersHolder();

        console.time('test - filter users');

        let usersToDisplay = [];

        users = originalUsers;

        // find user names (from initial list) that start with entered keystroke
        for (let g = 0; g < users.length; g++) {
          if (users[g].name.toLowerCase().startsWith(inputValue)) {
            // find matching users and put them in array
            usersToDisplay.push(users[g]);
          }
        }
        users = usersToDisplay;
        displayUsers(users, false);

        console.timeEnd('test - filter users');

      } else {

        clearUsersHolder();

        users = originalUsers;

        displayUsers(users, false);
      }
    }
/*
     * Filter users according to entered value
     */
Filter users according to entered value
Filter users according to entered value
function filterUsers() {
      let inputValue = this.value;
      if (inputValue !== '') {
        clearUsersHolder();
        console.time('test - filter users');
        let usersToDisplay = [];
        users = originalUsers;
        for (let g = 0; g < users.length; g++) {
          if (users[g].name.toLowerCase().startsWith(inputValue)) {
            usersToDisplay.push(users[g]);
          }
        }
        users = usersToDisplay;
        displayUsers(users, false);
        console.timeEnd('test - filter users');
      } else {
        clearUsersHolder();
        users = originalUsers;
        displayUsers(users, false);
      }
    }
function filterUsers ( ) { let inputValue = this . value ; if ( inputValue !== '' ) { clearUsersHolder ( ) ; console . time ( 'test - filter users' ) ; let usersToDisplay = [ ] ; users = originalUsers ; for ( let g = 0 ; g < users . length ; g ++ ) { if ( users [ g ] . name . toLowerCase ( ) . startsWith ( inputValue ) ) { usersToDisplay . push ( users [ g ] ) ; } } users = usersToDisplay ; displayUsers ( users , false ) ; console . timeEnd ( 'test - filter users' ) ; } else { clearUsersHolder ( ) ; users = originalUsers ; displayUsers ( users , false ) ; } }
Filter users according to entered value
Filter users according to entered value
// find user names (from initial list) that start with entered keystroke // find matching users and put them in array