"Question" JavaScript

Source: Internet
Author: User

1. An internal element triggers an event that generates event bubbling and one by one arrives at the parent element.
such as <a><b><c attr= "a" ></c></b></a>.
I click c to trigger the Click event, can I pass the attr property of C in the event object to the subsequent parent element bound to the event handler?
Then, bubbling to B, it can be thought that B also triggered the Click event, then finally when the event comes to a, a is a listener event, in the event handler for a, The element c that initially triggered the Click event can be obtained through event.target, but can I get the element B that also triggered the Click event?
2.<noscript> tag under Chrome, the first load will give the content inside the "" and so that all the content into text display in the page, again refreshed after the "" disappeared, all the labels to normal rendering.
3. Under the FF console, perform:
function f () {
var a = "a";
Console.log (a);
Console.log (a);
}
F ()
Then cut out the fourth line and execute:
function f () {
var a = "a";
Console.log (a);
}
F ()
Finally press CTRL + Z to return to the state before the cut, and then execute, will show the fourth line error referenceerror:a is not defined

4.if (!! Object) {...} The wording,!! Does object convert!obejct to False before passing! Convert to True to speed up?
5.Object > function and new Object < new function What the hell is going on?
6. Direct delete A, in the console is feasible, but written in the code in the compile time will be error:
syntaxerror:applying the ' delete ' operator to a unqualified name is deprecated
7.
var o = 9;
(function () {
var o = o;
Console.log (o)
});//Missing semicolon here, error (intermediate value) (...) is not a function
(function () {
Console.log (o)
})()

The above code will console
9
Undefined

The first reason is not Console.log (9), because the process is as follows:
var o;//undefined
o = o;//undefined

10.42.toFixed (3) will error Syntaxerror:identifier starts immediately after numeric literal, while 42.0.toFixed (3) will not.
Maybe it's because the former put the dot number as a decimal point.

11. In the child element, write ng-if, child element binding Click: Switch Scope property so that Ng-if is false, the parent element writes the event delegate to the child element binding click:console.log (' a ').
The event delegate for the parent element is not executed when the child element is clicked.
It is possible that the child element DOM was destroyed in the execution of the child element binding click, so that when the event is passed to the parent element, the parent finds that the DOM cannot find the child element, so there is no execution of the event delegate.
11.1 The problem is extended: The result of the parent element's event delegate is always present, so it is problematic to pay no attention to event delegate elimination.
12.post can I post a single value instead of an object? What about Get?
13.for-in can traverse to properties in prototype inheritance, but why can't for-in traverse to [].slice?
var F = function () {

}
F.prototype = {
A:2
}
var Q = function () {

}
Q.prototype = new F;

var B = new Q
for (var i in B) {
Console.log (i + ":" + b[i])//can print "A:2"
}
14. Repeated clicks will result in repetitive Ajax, how to avoid it?
15. Closures cause memory leaks. Is the object on the scope chain of the event handler always persisted when the event is bound to Elem? Does this result in a memory leak?
1190000002778015
Summarize why the nested function can continue referencing local variables within the scope of the parent function after it has been return?
The key is that after the nested function is return, its scope chain still points to the active object produced by its parent function.
16.
var d = new Date;
D.setmonth (5);
D.setdate (-1);
Console.log (D.getmonth ());
Console.log (D.getdate ())
17. How do I add an invisible super attribute to an object that points to its prototype?
18.0.2-0.1 = = = 0.1; 0.8-0.6!== 0.2//is actually going to be 0.2000 ... 7
Is this supposed to be a binary problem? When will the bug occur?

"Question" JavaScript

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.