Home javascript Announcement of variables in jQuery

Announcement of variables in jQuery

Author

Date

Category

How to declare variables in jQuery (it is in jQuery, and not in JavaScript, it is desirable to explain all the nuances, including $)?

  1. var, let and const used in javascript-e are allowed in jQuery?
  2. In addition to Var, Let and Const What else is used in jQuery?
  3. In what cases is $?

Answer 1, Authority 100%

var, let and const used in javascript, are allowed in jQuery?

Yes.

At least var is not desirable to use in new projects. Or with the full understanding of their features compared to Let and Const

In addition to Var, Let and Const What else is used in jQuery?

No.

jQuery is a library that uses native js , so the rules are exactly the same as even JS

In what cases is $?

My recommendation (and we are doing in the company in projects): All variables related to the object jQuery called that they start with $ . This will give an understanding to other people that, for example, in a variable $ Users – object jQuery with users, and not js Collection of objects.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions