JavaScript is a very free language, in JS, everything inside is a variable. including functions.
Basis
Function
Definition (parameter 1[, Parameter 2..]) The following code creates a function and executes it.
(function (str) {alert (str.length);}) (' Test_str ');
Http://vc.wz:80/l.html?q=5&b=5#ddd
The first field (the field is separated by a space) is one of the properties of Window.location, followed by its value.
Hash #ddd
Host VC.WZ:80
Hostname Vc.wz
href http://vc.wz/l.html?q=5
In JavaScript, there are two ways to use regular methods, one is to create an instance of a regular expression, but rather to use a regular expression in a string object to relate the method.
var my_regex=/[a-z]+/g;
var my_regex=new ("[a-z]+", "G");
EXEC (string), which is regular processing of a string and returns the result of the match.
Test (string), which tests whether a string contains a matching result
Regular in a regular string object in an Edit string object
Match (pattern) is a regular match based on pattern and, if matched to, returns a matching result, such as a match that does not return null
Search (pattern) is a regular match according to pattern, if the match to a result, then return its index number; otherwise return-1
Replace (pattern,replacement) is a regular match based on pattern, and the matching result is replaced by replacement
Split (pattern) is a regular segment based on pattern, which returns a segmented array.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.