Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment for _defaults and _name variables #68

Open
cm0s opened this issue Mar 18, 2013 · 1 comment
Open

Add comment for _defaults and _name variables #68

cm0s opened this issue Mar 18, 2013 · 1 comment
Milestone

Comments

@cm0s
Copy link

cm0s commented Mar 18, 2013

It could be useful to get a small comment above this code :

 this._defaults = defaults;
 this._name = pluginName;

Is it to ensure we access a protected defaults and plugin name variables which are not modifiable from outside the plugin (after the plugin initialization)?

@heldr heldr added this to the 4.0 milestone Sep 5, 2015
@heldr heldr modified the milestones: 4.0, 4.1.0 Jan 2, 2016
@heldr heldr modified the milestones: 4.2.0, 4.1.0 Feb 22, 2016
@Man7398
Copy link

Man7398 commented Aug 18, 2023

The _ prefix is a common convention for naming private variables in JavaScript. This helps to distinguish them from public variables, which are typically named without the _ prefix.

The following is a possible comment that could be added above the code:

// Store the default options and plugin name in private variables
// so that they cannot be modified from outside the plugin.
this._defaults = defaults;
this._name = pluginName;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants