Central tendency measures the position of the middle or the center of the data set. In your case, the value is 2 because both values are in the middle. That is why it is the median value. You can always change the function that I used to find the median, but here the median has no name, so I simply called it "middle value".