Home >Web Front-end >JS Tutorial >What is $ in javascript
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 "$".
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!