Nullish coalescing vs Logical || by aryan

Correction from previous post with same name.❤

The difference between these two operators are, nullish(??) operators consider 0 and “”,[],{} as a true.

Only null and undefined is considered as false.

const obj = {
name:’aryan khandelwal’
age:26
}


This content originally appeared on DEV Community and was authored by aryan015

Correction from previous post with same name.❤

The difference between these two operators are, nullish(??) operators consider 0 and "",[],{} as a true.

Only null and undefined is considered as false.

const obj = {
name:'aryan khandelwal'
age:26
}
obj?.['name'] //aryan khandelwal // only access 'name' when objest is defined.
obj||obj['name'] //aryan khandelwal


This content originally appeared on DEV Community and was authored by aryan015


Print Share Comment Cite Upload Translate Updates
APA

aryan015 | Sciencx (2024-06-17T16:47:23+00:00) Nullish coalescing vs Logical || by aryan. Retrieved from https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/

MLA
" » Nullish coalescing vs Logical || by aryan." aryan015 | Sciencx - Monday June 17, 2024, https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/
HARVARD
aryan015 | Sciencx Monday June 17, 2024 » Nullish coalescing vs Logical || by aryan., viewed ,<https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/>
VANCOUVER
aryan015 | Sciencx - » Nullish coalescing vs Logical || by aryan. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/
CHICAGO
" » Nullish coalescing vs Logical || by aryan." aryan015 | Sciencx - Accessed . https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/
IEEE
" » Nullish coalescing vs Logical || by aryan." aryan015 | Sciencx [Online]. Available: https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/. [Accessed: ]
rf:citation
» Nullish coalescing vs Logical || by aryan | aryan015 | Sciencx | https://www.scien.cx/2024/06/17/nullish-coalescing-vs-logical-by-aryan-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.