JS Cont.
1. Serialization
- Json.stringify (obj) serialization
- Json.parse (str) deserialization
2. Escape
- decodeURI () characters that are not escaped from the URL
- decodeURIComponent () non-escaped characters in the URI component
- encodeURI () escape character in Uri
- encodeURIComponent () escapes the characters in the URI component
- Escape () escapes the string
- Unescape () to escape string decoding
- Urierror is thrown by URL encoding and decoding methods
<Script> varURL= "http://www.baidu.com?n= Bao Qiang"; varret=encodeURI (URL); //alert (ret);Console.log (ret);//Http://www.baidu.com?n=%E5%AE%9D%E5%BC%BA varu=decodeURI (ret); //alert (u);console.log (u);//http://www.baidu.com?n= Bao Qiang varR2=encodeuricomponent (URL); Console.log (R2);//Http%3a%2f%2fwww.baidu.com%3fn%3d%e5%ae%9d%e5%bc%ba </Script>
3. Eval
Eval in JavaScript is a collection of eval and exec in Python that compiles code and can get return values.
< Script > eval ('alert (' eval ')') </Script >
- Evalerror executing JavaScript code in a string
4. Regular Expressions
Regular expressions are supported in JavaScript, which provides two main features:
- Test (string) to detect if a regular match
- EXEC (string) to get the contents of a regular match
Note: When you define a regular expression, "G", "I", "M" represent global matches, ignoring case and multiline matching.
5. Time Processing
Time-related operations are available in JavaScript, and time operations are divided into two types of time:
- Time Unification Time
- local time (East 8 district)
<Script>D= NewDate//Mon-20:12:57 gmt+0800 (CST)d.getutchours ()// Ad.getfullyear ()// .d.setminutes (D.getminutes ( $) +2)//1471263297229D//Mon-20:14:57 gmt+0800 (CST) </Script>
For more operations see: http://www.shouce.ren/api/javascript/main.htm
Front Js&&dom Cont.