With JavaScript version ES2020, optional chaining (?.) was first introduced to help read the value of…