New answers tagged javascript
2
votes
Are there any good and modern approaches, to have variables that feel global (no need to pass them around explicitly), yet are local to an instance?
As the experts in this community point out, the solution is obvious: use OOP, enclose the state in objects and live a happy life:
import {F} from './f';
...
// myLibrary/index.ts
export class ...
Top 50 recent answers are included
Related Tags
javascript × 2128web-development × 177
node.js × 143
html × 142
jquery × 121
design-patterns × 111
php × 108
web-applications × 93
design × 81
architecture × 76
css × 76
java × 72
html5 × 66
ajax × 65
object-oriented × 61
angularjs × 61
c# × 56
python × 56
functional-programming × 50
unit-testing × 49
coding-style × 45
programming-practices × 42
programming-languages × 42
security × 42
performance × 42