Classes are Useful
function foo() {
let someProperty;
// Some other initialization code
function someMethod() {
// Do some stuff with `someProperty`
// And potentially other things
}
// Maybe some other methods
return {
someMethod,
// Maybe some other methods
};
}let someProperty;
function foo() {
// Some initialization code
}
foo(); // some initialization code
someProperty = 123; // some more initialization
// Some utility function not exported
// later
export function someMethod() {
}最終更新