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