predict() function in R While predicting, what happens if we pass the newdata along with the target variable? Do we need to isolate the target variable before feeding into predict function?

data = read.csv("diabetes.csv")  #768 observations of 9 variables

#I split the data into train and test
set.seed(123)
IDS = 1:nrow(data)
train_data = sample(x = IDS,size = nrow(data)*0.7)
test_data = sample(x = setdiff(IDS,train_data),size = nrow(data)*0.3)
train_data = data[train_data,]
test_data = data[test_data,]

#Build logistic regression model
log_model1 = glm(formula = Outcome ~ .,data = train_data,family = 'binomial')

#Predict it on test or train
train_predict = predict(object = log_model1,newdata = train_data,type = "response")
As is common in R the answer depends and you should always double check to make sure including the target (or other) doesn’t affect the answer. But generally it won’t. Superfluous features are ignored as long as newdata includes all expected predictors present during training.