Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between 'state' and 'status' in function name?

Tags:

javascript

readyState
statusText
onreadystatechange
window.status

What's the difference between 'state' and 'status' in English ?

like image 702
lovespring Avatar asked May 20 '10 07:05

lovespring


2 Answers

Not much. I would tend to say state refers to more detailed information, but that's subjective.

For these:

XMLHttpRequest.readyState - one of 5 possible states for a request
XMLHttpRequest.statusText - The text equivalent of the HTTP response status (e.g. "200 OK")
XMLHttpRequest.onreadystatechange - function to call when readyState changes
window.status - status bar text (typically bottom left of window)

like image 182
Matthew Flaschen Avatar answered Oct 12 '22 15:10

Matthew Flaschen


They are quite similar, as they both signify the current properties of something. There is however a bit of a difference in how they are used:

A state is usually a single propery with some specific possible values. The readyState for example will cycle through some specific predefined values when a page loads.

The status is usually a collection of properties, or a description of them. The window.status property for example is just the text that is displayed in the status bar, and that can descibe any aspect of the content.

like image 35
Guffa Avatar answered Oct 12 '22 16:10

Guffa