Meaning the "$" symbol with parentheses for values of a variable

Asked

Viewed 55 times

1

I would like to know what that expression means that the variable receives in Javascript:

var wheight = $(window).height();

Doubts

  • What would be the "$" symbol with parentheses? And the point?
  • What comes after the point? What comes within the parenthesis?

1 answer

4

In javascript you can use the "$" symbol as variable or function name (identifier).

for example :

var $ = 0;

or

function $(){}

In the code posted, you are probably using the library jQuery, which assigns your code to a function, which takes as a parameter an html element or an html selector. When invoking the method it returns an object, which has attributes or functions that can be invoked through the object returns with the point.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.