On the usage of array splice,concat in JS and the supplementary knowledge of filter in ANGULARJS

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.