I'm currently delving into an Angular book, but I'm struggling to locate any definitive documentation regarding the usage of square brackets in a lambda expression like
[hours, rate]) => this.total = hours * rate
. While I grasp that these parameters (hours and rate) can be accessed within the lambda function's body, I am puzzled by why (hours, rate) => this.total = hours * rate)
is not functioning as expected and why the brackets [] are necessary.
Observable.combineLatest(this.invoiceForm.get('hours').valueChanges,
this.invoiceForm.get('rate').valueChanges).subscribe(
([hours, rate]) => this.total = hours * rate);
If anyone could shed some light on what this syntax signifies and direct me towards relevant documentation, it would be greatly appreciated.
Just a heads up: I have a good grasp on what combineLatest accomplishes; my confusion lies specifically with the lambda expression using those brackets.