'Optional-chaining in Angular
Solution 1:[1]
optional chaining was introduced in ES2020 freeCodecamp.org. If you are your using js version before ES2020, you will get that error.
That might be the reason why you couldn't use optional chaining,
solution:
duplicate = someObj.wild_animals ? someObj.wild_animals : undefined
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Vinay Somawat |