0

Three (out of 8 or so) of the parameters in an object have an underscore at the beginning of their name. The underscores aren't in my json object and I can't decipher why Firebug would add them in. The same properties are listed later in the object but without the underscores. I'm sure it's trivial but I'm curious to know.

Here's a screenshot:

firebug

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
orolo
  • 3,951
  • 2
  • 30
  • 30

2 Answers2

1

Prefixing a variable/property name with an underscore is simply a JavaScript coding convention. It usually implies that those variables are "private," or at least not meant for use by "outsiders."


There are a number of other languages which actually use underscore prefixes. For instance, two preceding underscores (__) makes a member private in Python; in C++, a single leading underscore is reserved in global namespaces (source).

Also see this question.

Community
  • 1
  • 1
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
1

Firebug does not add underscores to variables. These underscores are already there.

johnjbarton
  • 1,857
  • 1
  • 13
  • 12