function deleteNotification(uid) {
    var deleteNotificationBool = true;
    console.log("Deleting " + uid);

    var toDelete = readNotificationArr.indexOf(notificationArr[uid]);
    readNotificationArr.splice(toDelete, 1);

    for (var i = 0; i < readNotificationArr.length; i++){
      if(readNotificationArr[i] == notificationArr[uid]){
        deleteNotificationBool = false;
      }
    }

    if(deleteNotificationBool) {
      notificationArr.splice(uid, 1);

      if (notificationArr.length == 0) {
        sessionStorage.setItem("notificationOverride", "notificationArrEmpty");
      }

      user.notifications = notificationArr;

      firebase.database().ref("users/" + user.uid).update({
        notifications: notificationArr
      });

      updateReadNotificationToDB();

      removeNotificationElement(uid);
    } else {
      alert("Notification Not Deleted, Please Try Again!");
    }
  }
//This function deletes a given notification from the current user's data and updates it to the database.
This function deletes a given notification from the current user's data and updates it to the database.
This function deletes a given notification from the current user ' s data and updates it to the database .
function deleteNotification(uid) {
    var deleteNotificationBool = true;
    console.log("Deleting " + uid);
    var toDelete = readNotificationArr.indexOf(notificationArr[uid]);
    readNotificationArr.splice(toDelete, 1);
    for (var i = 0; i < readNotificationArr.length; i++){
      if(readNotificationArr[i] == notificationArr[uid]){
        deleteNotificationBool = false;
      }
    }
    if(deleteNotificationBool) {
      notificationArr.splice(uid, 1);
      if (notificationArr.length == 0) {
        sessionStorage.setItem("notificationOverride", "notificationArrEmpty");
      }
      user.notifications = notificationArr;
      firebase.database().ref("users/" + user.uid).update({
        notifications: notificationArr
      });
      updateReadNotificationToDB();
      removeNotificationElement(uid);
    } else {
      alert("Notification Not Deleted, Please Try Again!");
    }
  }
function deleteNotification ( uid ) { var deleteNotificationBool = true ; console . log ( "Deleting " + uid ) ; var toDelete = readNotificationArr . indexOf ( notificationArr [ uid ] ) ; readNotificationArr . splice ( toDelete , 1 ) ; for ( var i = 0 ; i < readNotificationArr . length ; i ++ ) { if ( readNotificationArr [ i ] == notificationArr [ uid ] ) { deleteNotificationBool = false ; } } if ( deleteNotificationBool ) { notificationArr . splice ( uid , 1 ) ; if ( notificationArr . length == 0 ) { sessionStorage . setItem ( "notificationOverride" , "notificationArrEmpty" ) ; } user . notifications = notificationArr ; firebase . database ( ) . ref ( "users/" + user . uid ) . update ( { notifications : notificationArr } ) ; updateReadNotificationToDB ( ) ; removeNotificationElement ( uid ) ; } else { alert ( "Notification Not Deleted, Please Try Again!" ) ; } }
This function deletes a given notification from the current user's data and updates it to the database.
This function deletes a given notification from the current user ' s data and updates it to the database .