Ali 2-way front-end pen test + sugar 2-way front-end pen questions

Source: Internet
Author: User

Ali front-End pen questions

1, a table HTML code is as follows

<table id= "Table1" >

<tbody>

<tr><td>1</td><td><button>Delete</button></td></tr>

<tr><td>2</td><td><button>Delete</button></td></tr>

<tr><td>3</td><td><button>Delete</button></td></tr>

</tbody>

</table>

When the user presses the Delete button and deletes the row (TR) that is pressed, use native JavaScript implementations.

2. Background:
1. Object A directly invokes a method of object B to implement interactive logic. But the problem is that A and B are tightly coupled, and modifying B may invalidate the method of a call B.
2. In order to solve the problem caused by coupling, we can design:
Object A generates a message, notifies the message Processor (Observable), to an event message processor, to pass the message to B
The specific invocation process becomes: a.emit (' message ', data); B.on (' message ', function (data) {});
Please implement this event message Agent feature

Please add the event message functionality to complete
function Eventemitter () {

}

Pile of sugar 2-way front-end pen questions

1. Write a jquery component that gets the key/value of all the elements in the form form and submits it as an Ajax method. The serialization method provided by JQ cannot be used.

2.

There is an array of 3,10,45,6,7,8,9,9,6,5,42,54,6,5,76,7,54,45,45,67,67,4,100,7,32,20,42,84,81,22, each randomly deleting one of the elements, asking after 5 deletions, ask questions The 16th element in the new array, in the same position as the original array.

Answer

Just create a bolean array of the same size as the original input array, initialize all 0, delete an element in the original array, corresponding to the same indexed elements of the Boolean array 1, so after 5 delete, sequentially traverse the boolean array, skipping 1 elements, The element that is known to access the 16th value is 0, and the array subscript of the element is output

Ali 2-way front-end pen test + sugar 2-way front-end pen questions

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.