What does $ mean in pure Javascript

I watched a video about object literals in JS. Then the guy in the video did something like this:

var Facebook = {
    name: 'Facebook',
    ceo: {
        firstName: "Mark",
        favColor: "Blue"
    },
$stock: 110
};

      

My question is, why is there a $ in front of the icon? Does it make any special sense? or was he just using it for naming purposes only? I entered $ in the console and got something like this: function $(selector, [startNode]) { [Command Line API] }

I understand that the $ sign is used as a selector for JS libraries like JQuery, but what is the significance in pure JS?

+3


source to share


2 answers


It's just a character. If you saw something in the console, because some script loaded by that page assigned a value to it and was still in the global scope.

Sometimes (for example with jQuery or Angular) it can be used conventionally to indicate that the value assigned to that variable or property is related in some way to those libraries.



In your example, this is just the name of the property.

+1


source


$

doesn't really matter in JavaScript. This is just a valid variable name. See this answer .



0


source







All Articles