Ife_part2_javascript_ array de-weight/trim ()

Source: Internet
Author: User
Tags new set
Array de-weight method setfunction Uniqarray (arr) {//sets the array to be    processed first, generating a Set object (Set object allows you to store any type of unique value, whether it is the original value or an object reference.) ), and then convert the Array.from into an array    //Array.from () method to create a new array instance from a similar array or an iterative object.    return Array.from (New Set (arr))}var a = [1, 3, 5, 7, 5, 3];var B = Uniqarray (a); Console.log (b);//implement a simple trim function to remove a A string header and trailing white space character function Simpletrim (str) {    return Str.trim ()}//use regular expressions to remove the trailing whitespace character of the string, function trim (str) {    Return Str.replace (/(^\s*) | ( \s*) $/g, "");}

  

Ife_part2_javascript_ array de-weight/trim ()

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.