1, jQuery.extend () // jQuery library in the one or more target object objects into object methods
. 1 // $ .extend (In Flag, target, OBJ1, ... objn) 2 // In Flag indicates whether the depth combined, can be omitted . 3 // target audiences, obj1, objN to be merged with the object . 4 var object1 = { . 5 Apple: 0 , . 6 Banana: {weight: 52 is,. price: 100 }, . 7 Cherry: 97 . 8 }; . 9 var object2 = { 10 Banana: {. price: 200 is }, . 11 Durian: 100 12 is }; 13 is // not depth combined, the latter over the former property of the same name 14.extend $ (object1, object2) // {Apple: 0, Banana: {. price:} 200 is, Cherry: 97, Durian: 100}
// merge the extension available for ES6 {... object1, ... object2}
15 16 // depth combined . 17 $ .extend ( to true , object1, object2); // { "Apple": 0, "Banana": { "weight": 52 is, ". price":} 200 is, "Cherry": 97 , "durian": 100}
2, navigator.platform // navigator is a global object, navigator.platform () returns the browser operating system platforms (example: "MacIntel", "Win32", etc.)
3, E-mail, account number, phone number and call the regular expression method validation
1 // email address Verification: [email protected], AAAA numbers beginning with the letter, after underscores including alphanumeric and dashes "-" component, BBBB letters, numbers, CCC domain name suffix letters 2-4 2 the let EmailReg = / ^ ([a-zA-Z ] | [0-9]) (\ w | \ -) + @ [a-zA-Z0-9] + \ ([a-zA-Z] {2,4}. ) $ / ; 3 4 // account verification: letters, numbers, underscores, starting with a letter 4-16. . 5 the let acNoReg = / ^ [A-zA-the Z] (\ W {. 3, 15}) $ / ; . 6 . 7 // phone number verification: 11 digits at the beginning. 1 . 8 the let Tel = / ^. 1 \ D {10 $} / ; . 9 10 @ telephone: area code + number; the beginning of the area code 0, 3-4, 7-8 numbers; with or without area code and number between the "-" connection . 11 the let phone = / ^ 0 \ ? d {3, 4} - \ d {7, 8} $ /;
4, React setState modify data in the array, the view is not updated; key value to a node increases, modify the array data while dynamically changing the key value has reached the object updated view (not good)
5, babel-polyfill: work with the browser environment does not support the new property methods ES6, so the introduction of babel-polyfill, provide a spacer for the current environment.
polyfill: means "for achieving browser does not support native code for the function"