Closed ArashMotamedi closed 6 years ago
I'd like to suggest that the nullish-coalescing operator also be usable for index access:
let person = { name: "John" } let cityLength = person.address?["city"]?.length
let repo = { name: "myrepo", // commits: [{ date: "2017/12/01" }, {date: "2017/12/02"}] } let firstCommitDate = repo.commits?[0]?.date;
I think you want the optional-chaining proposal. It already encompasses dynamic property access.
@tvald Yes! Thanks! Perils of creating an issue way too late at night!
I'd like to suggest that the nullish-coalescing operator also be usable for index access: