7. What possibly unintentional behaviour is exhibited in the following code and how would you correct it?
function buildItems() { var i, arr = []; for (i = 0; i < 20; i++) {
arr.push({ item: create(i), kill: function() {
remove(i); }
}); } return arr;
} buildItems()[10].kill();
4 comments:
'Kill function'? Wasn't that in Robocop?
The final call "buildItems()[10].kill();" will call the remove function with "20" as its parameter, not "10" as you might expect.
It is entirely possible to EDIT markup in a textarea. The behavior of HTML entities within a textarea allows for this behavior, but it must be done correctly to be valid. Server-Side Navigation Bar and is the fancy name given to the ring navigation code that is called by a piece of javascript. It is on the page where you copy this piece of javascript that I had the problem of it rendering rather than showing in the textarea.
Cheers!!
Post a Comment