Mobile phone Various JS syntax, update at any time

Source: Internet
Author: User

How do I eliminate duplicate elements in an array?

var arr1 =[1,2,2,2,3,3,3,4,5,6],     arr2 = []; for (var i = 0,len = Arr1.length; i< len; i++) {     if (Arr2.indexof (arr1 [i]) < 0) {         arr2.push (arr1[i]);         }     } document.write (ARR2);//1,2,3,4,5,6

Write a function that clears the space before and after the string. (compatible with all browsers)

function Trim (str) {if (str&&typeof  str = = = "string") {return str.replace (/(^\s)/(LS) $/ G, "");//Remove whitespace before and after}}

What is the process of a complete HTTP transaction?
Basic Flow:
A. Domain Name resolution
B. 3-time handshake to initiate TCP
C. Initiating an HTTP request after establishing a TCP connection
D. server-side response HTTP request, browser gets HTML code
E. Browser parsing HTML code and requesting resources in HTML code
F. Browser renders a page rendering to the user

How do you understand the position of the front-end engineer?
A. Front-end is the most user-close programmer, the ability of the front end is to allow the product from 90 points to 100 points, or even better
B. Participate in the project, fast and high-quality implementation, accurate to 1px;
C. Communication with team members, UI design, product manager;
D. Good page structure, page refactoring and user experience;
E. processing hack, compatible, write beautiful code format;
F. Optimized for servers, embracing the latest front-end technology.

Mobile phone Various JS syntax, update at any time

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.