Created
January 4, 2021 22:03
Revisions
-
codingedgar created this gist
Jan 4, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ console.group('Logical OR assignment (||=)'); const a = { duration: 50, title: '' }; a.duration ||= 10; console.log(a.duration); a.title ||= 'title is empty.'; console.log(a.title); console.groupEnd(); /* Console: Logical OR assignment (||=) 50 title is empty. */ // Other usefull example can be: document.getElementById('lyrics').textContent ||= 'No lyrics.'