I am studying a bit Angular docs and there's an assignment I do not really get.
setTimeout(() => this.seconds = () => this.timerComponent.seconds, 0);
Does it set a reference of this.timerComponent.seconds to this.seconds? Given that both seconds and timerComponent.seconds are methods, is it equivalent to the following?
setTimeout(() => { this.seconds = this.timerComponent.seconds }, 0);
It's equivalent to
setTimeout(() => { return this.seconds = (() => { return this.timerComponent.seconds; }); }, 0);
It passes a function to setTimeout that, when called, assigns a function to this.seconds that, when called, returns the current value of this.timerComponent.seconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With