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