A JS array-related operation
1. Splice function, can do insert, delete, replace operation
1<script>2"Use Strict"3 vararr = [' Z3 '];4Arr.splice (1,0, ' L4 '));5 alert (arr); Z3,l46Arr.splice, ' W5 ');7 alert (arr); Z3,w58Arr.splice ();9 alert (arr); Z3TenArr.splice (10,1, ' L4 ', ' W5 '); One alert (arr); Z3,l4,w5 A Arr.splice ( -2,2); //Note here, starting at the second position of the last forward number of the array, delete the value of two positions, that is, delete the last two values - alert (arr); Z3 -</script>
2. Concat function, merges multiple arrays, returns a new array, does not modify the original array
1 <script>2 "Use strict"3 var arr1 = [' Z3 ', ' L4 ']; 4 var arr2 = [' W5 ']; 5 alert (Arr1.concat (ARR2)); Z3,L4,W56 alert (arr1);//z3,l47 alert (arr2);//w5 8 </script>
Complementary knowledge of the filter in the two pairs of angularjs
Using filter in HTML, you can <span>{{createat | date: ' YYYY '}}</span>
Using the angular built-in date filter, the filter used in this case accepts multiple parameters, which can be: {{expression | filter:param1:param2 ...}}, when actually executing the function of the filter definition. The first parameter received is expression, the specified parameter param1,param2, and so on, starting from the second argument to the back row
On the usage of array splice,concat in JS and the supplementary knowledge of filter in ANGULARJS