The absence of meaning and the value of undefined is a rarity of the most ancient times of information technology, but even in the modern world they have a place and meaning. It does not always make sense to make a decision. Sometimes it makes an objective sense to postpone decision-making until later.
Historical semantic moment
By itself, void means "nowhere", "do nothing" or, in the sense of JavaScript void, - undefined.
The use of the void keyword has made the C / C ++ programming language more famous than other (then still local) programming languages. But not only C / C ++ declared the absence of the result of an action (function) as a given special kind.
The theory and practice of programming has always had a variant of the meaning "lack of value", but few languages still have the meaning of "rollback" values and "cancel" the action.
Judging by the logic of things, the lack of a result is also a result. Formally, any algorithm provides holistic functionality and presentation of information.
Modern realities of Internet programming
In modern online HTML / CSS practice:
- markup code;
- form of presentation of information in a specific application;
- subject of analysis in the same specific application.
JavaScript Browser Language:
- logic and events;
- algorithm and functionality;
- lack of a history of changes (data) and rollback of actions (algorithm).
The term void has retained its vague meaning until now. In the JavaScript context, void results in an undefined value.
By itself, the call of the functional occurs, the action is performed, the function fulfills a certain result, but ultimately the "official" result is the declaration of the absence of a result, that is, the value is undefined.
Scope void and undefined
Usually JavaScript void and the value undefined are used in links <a href ..., this is a private use case where an action can be performed, but the browser will know the opposite:
- Action failed.
- Continuation should not follow.
In fact, the complexity of the HTML markup language, its relationship with CSS tables, and the powerful development of the browser language led to the opposite: JavaScript void 0, which means or does not mean, does not concern the browser.
The developer can invest his own meaning, a different understanding of the situation. It can orient the algorithm leading to a JavaScript void call on anything. The developer has the syntax and basic meaning of the browser language, the rest depends on the problem being solved, its area of competence and the logic of the dialogue with the visitor to the web resource.
Blocking browser actions in a particular element of a web resource page is often necessary for no apparent reason on the simple reason that the algorithms are very complex, and it’s very difficult to foresee the path to the element and visitor’s actions.
It is easier to provide a set of actions for orientation in a situation, but before you can start the algorithm further, block the browser in one direction or another.