Home > Web Front-end > JS Tutorial > Collection of Js skills that everyone may not know_javascript skills

Collection of Js skills that everyone may not know_javascript skills

WBOY
Release: 2016-05-16 19:05:36
Original
1375 people have browsed it

1.document.GetElementsByTagName can get all the elements of a certain tag. You can get all the elements on the page through
document.getElementsByTagName('*')
. The asterisk here represents any tag, and the comment tag The tagName is "!"

2. The difference between String method substr and substring
substr(start[,length]);//Indicates taking length strings from the start position
substring (start, end);//Represents the string from start to end, including the character at the start position but excluding the character at the end position

3. "==" and "==="
The former compares two objects and will automatically perform type conversion. For example, comparing '12' == 12 will return true; while the latter does not perform any conversion and must be completely equal to '12' === 12 will return false

4. How to prevent the webpage from being saved