Record some of the functions and concepts that you frequently query and use.
It is only for your convenience, you can click the upper right corner.
jquery
<input type="text" value="123"/ id="xx"> #xx.val()
<input type="radio" value="123" name="hello" checked/> $("[type=radio]:checked")
<input type="checkbox" value="123" name="hello" checked/> $("[type=checkbox]:checked")
select value="adsf"
<option value="123">123</option> select.val() $(":selected").val()
html special escape character
- : blank space (non-breaking spacing)
- <: less than
- >: greater than
- &:符号&
- ": Double quotation marks
- ': single quote
- ©: Copyright ©
- ™: Trademark™
- 绐: Text string. Actually, #32464 is the unicode encoding of Chinese characters
js
this points to
- If the function has an object, it points to the object
- The function does not belong to the object, the image points to the global
- Construct a function with new, which points to the new object
- apply, call, bind change this point
Common functions
for ……in traverses all objects, objects on the prototype chain, and enumerable properties
Object.keys() traverses all enumerable properties, excluding the prototype chain.
hasOwnPropertyNames(), traverse all its own properties (including non-enumerable), excluding the prototype chain, and the symbol can not be obtained.
String commonly used functions
substring
str.substring( start [, end])
- Returns a string
- The parameter cannot be less than 0, and cannot be greater than length, otherwise it is 0 or length
- If start <end, replace both
- If end is omitted, the string is extracted to the end.
Array commonly used functions
slice
- Return a new array
- Shallow copy
- If the parameter is negative, it will count down. slice(-2, -1). Cut from the penultimate to the penultimate.
nodejs
Common commands
Dependencies: Dependencies
dependencies:生产环境
npm install module_name -S
npm install module_name --save
devDependencies: development environment
npm install module_name -D
npm install module_name --save-dev
i is short for install
npm i -s module_name