Last active
May 1, 2019 15:58
-
-
Save jlittlejohn/6204b26bd8e526aa0172 to your computer and use it in GitHub Desktop.
JS: Check to see if a property exists on a Method
This file contains hidden or 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
// Check if this.property exists, if so use it, if not create it and add value to the array | |
var object = { | |
method: function (value) { | |
this.property = this.property || []; | |
this.property.push(value); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment