Created
October 26, 2020 13:31
-
-
Save KyleMit/05c2fa62ef5472c165d40af267687a81 to your computer and use it in GitHub Desktop.
Twitter - Logical OR Assignment Operator
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 characters
let person = { name: "Frida" } | |
// original | |
person.city = person.city || "unknown" | |
// with logical or assignment operator | |
person.city ||= "unknown" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment