- It is not possible to reassign an argument in a method.
(a) => { a = 2; }will not work.
However, it is possible to reassign a property of an argument object in a method, so(a) => { a.value = 2; }will work. - Promise execution has a different queue than normal code. This can be important in testing async code: in the test we'll have to make sure the test execution waits for the promise to resolve, before testing the return value or side effect.
- Optional chaining saves you the trouble of testing for undefined keys in nested objects. Eg.
person.address?.street?.name - Use a variable's value as a key in and object with this syntax:
{ [yourKeyVariable]: someValue } - ...
Showing posts with label note. Show all posts
Showing posts with label note. Show all posts
Tuesday, April 27, 2021
Javascript Tips and Tricks
Wednesday, December 4, 2019
Friday, August 24, 2018
Wednesday, December 2, 2015
Note to myself: JQuery vs HTML DOM native
- https://viget.com/inspire/jquery-or-native-method-everyday-techniques-no-3
Subscribe to:
Posts (Atom)