Front End engineer Face question JavaScript section (fifth quarter)

Source: Internet
Author: User

Alert (' 1 ' + 1)//11, not 2, this easy to forget

The second question, it's all basic, it's easy to fall out of the pit.

(function() {     var a = b = 6;}) () Console.log (b); // 6 global variable declaration

In advance of the third question statement

function Test () {  console.log (a);  Console.log (foo ());   var a = 1;   function foo () {     return 2;  }} test ();

This is simple.

var fullname = ' John Doe '; var obj = {  ' Colin ihrig ',  prop: {     ' Aurelio De Rosa ',       function() {        returnthis. FullName;}}  } Console.log (Obj.prop.getFullname ()); var test = obj.prop.getfullname;console.log (Test ())'

Next, the handwriting event agent

functiondelegateevent (Interfaceele, selector, type, fn) {if(Interfaceele.addeventlistener) {Interfaceele.addeventlistener (TYPE,EVENTFN,false); }      Else{Interfaceele.attach (' On ' +TYPE,EVETNFN); }    functionEVENTFN (e) {varE = e| |window.event; vartarget = E.target | |e.srcelement; if(Matchselecter (Target,selector)) {//whether a is a          if(FN) {fn.call (target,e); }     }   }}functionMathcselector (ele,selector) {if(Selector.charat (0) = = = ' # '){      returnEle.id = = Selector.slice (1); }   if(Selector.charat (0) = = '. '){      return("+ ele.classname+". IndexOf ("+ selector.slice (1) +")! =-1)    returnEle.targetName.toLowerCase () = = =slector.tolowercase (); }}varOdiv = Docyment.getelementbyid ("Odiv");d elegateevent (Odiv,' A ', ' click ',function() {alert (1)})

Front End engineer Face question JavaScript section (fifth quarter)

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.