If I were to create the following namespace and class in Typescript, what difference would there be between the two? Does the memory management differ between the two?
export namespace TestNamespace {
export const Test = 'TEST';
export const TestFunction = (value:string):boolean => {
return !value || value.length === 0;
}
}
export class TestClass {
static Test = 'TEST';
static TestFunction(value:string): boolean {
return !value || value.length === 0;
}
}
They can both be called in the same way:
console.log(TestClass.Test);
console.log(TestClass.TestFunction('Test'));
console.log(TestNamespace.Test);
console.log(TestNamespace.TestFunction('Test'));
Is the only difference just the preference in how it's written?