Skip to content

Conversation

@lumosmind
Copy link
Contributor

optional chaining returns undefined for null and undefined

let user1 = {name:undefined};
let user2 = {name:null};
user1.name?.toUpperCase(); //undefined
user2.name?.toUpperCase(); //undefined

but article says that it can return null for some cases like this
user2.name?.toUpperCase(); //null --> this is not possible

optional chaining returns undefined for null and undefined
let user1 = {name:undefined};
let user2 = {name:null};

user1.name?.toUpperCase(); //undefined
user2.name?.toUpperCase(); //undefined

but article says that it can return null for some cases like this
user2.name?.toUpperCase(); //null   --> this is not possible
@iliakan iliakan closed this in c7d3072 Jan 13, 2021
@iliakan
Copy link
Member

iliakan commented Jan 13, 2021

Fixed. Thanks!

@lumosmind lumosmind deleted the patch-63 branch January 13, 2021 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants