Reading up on hoisting and using 'const' vs 'function', in Javascript, for either assignment or declaration, one warning some highlighted was that functions can be reassigned when hoisted.
So I wonder if this problem still exists today in Typescript (and/or Angular). Wouldn't a compiler prevent this? For example what about the Typescript compiler, or Angular compiler?
Also, till what extend are functions able to be reassigned if the compiler wouldn't help with this? Would this work, for example?
A.ts
export function giveANumber(): number {
return this.getRandomNumber();
}
function getRandomNumber(): number {...}
B.ts
import { giveANumber } from ...;
getRandomNumber = 43;
export function giveANewNumber(): string {
return giveANumber();
}