Home  >  Article  >  Web Front-end  >  What is $ in javascript

What is $ in javascript

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-15 13:33:199895browse

The "$" symbol in JavaScript means: 1. It can be used to represent variables; 2. In regular expressions, it can match the end; 3. "$" represents a jQuery object, which is a Identifier, because JavaScript allows variable names starting with "$".

What is $ in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer. The meaning of $ in

js is: The

$ symbol is a characteristic character representing variables in PHP. It also has many functions in JS. Generally, we use it to name a function name and obtain the ID. of.

1. First, it can be used to represent variables, such as variables var s='asdsd' or var $s='asdasd';

2. In regular expressions, it can match the end /sa$/.test(string) matches sa in the string string. For example, string='125sa' matches, string='125sa21' does not match. Regular expressions are very complicated, and here is just a brief explanation.

3. $ represents the jQuery object, which is an identifier (Identifier), because JavaScript allows variable names starting with $.

Extended information

JavaScript is classified as a literal translation language, because mainstream engines load the code and interpret it every time it is run. V8 interprets all the code before starting to run, while other engines interpret it line by line. However, since most of the core parts of V8 are written in JavaScript (and SpiderMonkey is written in C), the performance of the two is mutually exclusive in different tests. There are pros and cons.

Corresponding to it is a compiled language, such as C language. Before a program written in a compiled language can be run, it must be compiled to compile the code into machine code and then run.

[Recommended learning: javascript advanced tutorial]

The above is the detailed content of What is $ in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn