Summary of key knowledge of JavaScript & bootstrap & XML (elementary part of JS)

clionlin 2022-05-22 11:57:42 阅读数:332

summarykeyknowledgejavascriptbootstrap

JavaScript:

 JS Special grammar :
1. Statement to ; ending , If there is only one statement in a line ; It can be omitted ( Don't suggest )
2. The definition of variables uses var keyword , You can also not use
* use : The variables defined are local variables
* no need : The defined variable is a global variable ( Don't suggest )
The basic object :
Function: function ( Method ) object
establish :
1. var fun = new Function( List of formal parameters , Method body ); // Forget it
2.
function Method name ( List of formal parameters ){
Method body
}
3.
var Method name = function( List of formal parameters ){
Method body
}
attribute :
length: Represents the number of formal parameters
characteristic :
1. The definition of the method is , The type of parameter does not need to be written , The return value type does not write .
2. Method is an object , If you define a method with the same name , Will be covered
3. stay JS in , Method calls are only related to the name of the method , Nothing to do with the parameter list
4. There is a hidden built-in object in the method declaration ( Array ),arguments, Encapsulate all the actual parameters
call :
Method name ( List of actual parameters );
Array: Array objects
1. establish :
1. var arr = new Array( List of elements );
2. var arr = new Array( Default length );
3. var arr = [ List of elements ];
2. Method
join( Parameters ): Concatenate the elements in the array into strings according to the specified delimiters
push() Add one or more elements... To the end of the array , And returns the new length .
3. attribute
length: Length of array
4. characteristic :
1. JS in , The type of array element is variable .
2. JS in , Array length is variable .
Date: Date object
1. establish :
var date = new Date();
2. Method :
toLocaleString(): Returns the current date Object corresponding time local string format
getTime(): Get millisecond value . Return the time of current scheduled object description to 1970 year 1 month 1 Millisecond difference of day zero
Math: Mathematical objects
1. establish :
* characteristic :Math Objects don't have to be created , Use it directly . Math. Method name ();
2. Method :
random(): return 0 ~ 1 Random number between . contain 0 Not included 1
ceil(x): Round up logarithm .
floor(x): The logarithm is rounded down .
round(x): Round a number to the nearest whole number .
3. attribute :
PI
Number
String
RegExp: Regular expression objects
1. Regular expressions : Define the composition rules of string .
1. Single character :[]
Such as : [a] [ab] [a-zA-Z0-9_]
* A single character representing a particular meaning :
\d: Single digit characters [0-9]
\w: Single word characters [a-zA-Z0-9_]
2. Quantifier symbols :
?: Appear 0 Time or 1 Time
*: Appear 0 Times or times
+: appear 1 Times or times
{m,n}: Express m<= Number <= n
* m If the default : {,n}: most n Time
* n If the default :{m,} least m Time
3. Start and end symbols
* ^: Start
* $: end
2. Regular objects :
1. establish
1. var reg = new RegExp(" Regular expressions ");
2. var reg = / Regular expressions /;
2. Method
1. test( Parameters ): Verify that the specified string conforms to the specification of the regular definition
Global
1. characteristic : Global object , This Global Methods encapsulated in can be called directly without objects . Method name ();
2. Method :
encodeURI():url code
decodeURI():url decode
encodeURIComponent():url code , More characters to encode
decodeURIComponent():url decode
parseInt(): Convert string to number
* Judge whether each character is a number one by one , Until it's not a number , Turn the front digital part into number
isNaN(): Judge whether a value is NaN
* NaN not to recognize one 's own closest relatives , I don't even recognize myself .NaN Participating == Compare all questions false
eval(): speak JavaScript character string , And execute it as script code .
3. URL code
Spreading wisdom Podcast = %E4%BC%A0%E6%99%BA%E6%92%AD%E5%AE%A2

copyright:author[clionlin],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/142/202203140552568380.html