Search code snippets, questions, articles...
All code snippets
Login
Register
+
Add new Snippet
Add new code snippet that you can easily search
Ask Question
If you stuck somewhere or want to start a discussion with dev community
Write Article
Share your knowledge by writing article and spread it
Chrome Extension
My Account
Browse
Javascript
React
Redux Form
Gulp
Javascript Basics
Vue.js
Chart.js
Lodash
Python
Python
SQLAlchemy
Django
Pandas
All
PHP
MySql
neo4j
AMP
Ubuntu
Flutter
Dart
Dev Tools
All
Code Manager
JSON Viewer
Javascript Runner
Comma Converter
HTML Editor
SCSS to CSS
SQL Formatter Online
Discussions
Articles
JSON Viewer
Dev Profile
More
Code snippets
Knowledgebase
About Us
Contact Us
React Basics
Create new react app
Create new component in React
Add CSS class dynamically in React
Bind form or input elements with state in React
List and map in React
Render item condition based React
Routing in React
Loop through an object using map
Filter an Array of Objects in React
Render a string as HTML in React
React Examples
Loop n times in React
Get index in map React
[React]Add or push values to array defined in state
Nullish coalescing operator (??)
Map State to Props using React + Redux
How to use loop in React JSX
Render components after asynchronous call in React
Highlight the highest value list item
Searchable list in React
Create a tab component in React
Nullish coalescing operator (??)
javascript
Share on :
The ?? checks if the value on the left is null or undefined and, if it is, will return a supplied value on the right.
Copy Code
const nullValue = null const valA = nullValue ?? "default for A"
Output
default for A
Contribute to this Snippet
Was this helpful?
Yes
No
Created by :
@
Write your Comment
0
Comments
Similar code snippets
Use of ?? (Nullish Coalescing Operator) in Javascript
Javascript ES6 Spread Operator
How to use Ternary Operator in place of if else statements Javascript
Create your own code snippets and search them using our portal and chrome extension
Programming Feeds
Learn something new everyday on Devsheet
Important Links
Contribute to this Snippet
Join Devsheet
Create new snippet
Ask a Question
Write an article
Online JSON Viewer
0 Comments