When creating this namespace and class in Typescript, what distinguishes the two? How does memory management vary between them?
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;
}
}
Both can be invoked similarly:
console.log(TestClass.Test);
console.log(TestClass.TestFunction('Test'));
console.log(TestNamespace.Test);
console.log(TestNamespace.TestFunction('Test'));
Is the only contrast simply in the preferred format of writing it?