JSFiddle - React, Tailwind, and code Playground
JavaScript
var MyModule = { //declare namespace MyModule
variable1: 0,
variable2: 1,
method1: function() {
//code goes here
},
method2: function() {
//mode code goes here
},
method3: function() {
//and some more just to prove the pattern
}
}
//method1(); //error - no such method - ok, good, I expect that
variable1 = 5; //silently assigns a variable inside MyModule to 5 ?
alert(variable1);
alert(MyModule.variable1);