This article only records the usual easy to ignore knowledge points
1, variable declaration
Variables must start with a letter
Variables can also start with the $ and _ symbols (although we do not recommend this)
Variable names are case sensitive (Y and y are different variables)
2,indexof Search Differences
Indexof,search can see whether the specified string is in a string, and returns the location of the first occurrence of the specified string in the string.
If you just look for a specific string, the system resources using indexof () are less expensive and more efficient; If you are looking for a string with some characteristics (such as looking for a string that starts with a, followed by a number), then indexof () is powerless. You must use the regular expression and the search () method.
Many times using indexof () is not to really want to know the location of the substring, but rather to know that the long string does not contain this substring. If the return index value is-1, then the description does not: Not equal to 1, then there is.
So in general, indexof is more resource-saving than search.
JS Basic article