-
context of setTimeout and eval
setTimeout is a method of window object. “this” context refer to the window. But you can change its context in the following way. setTimeout does not support call method.
setTimeout(function() { alert(this); }, 0); //window //setTimeout.call({}, function() { alert(this); }, 0); //not supported setTimeout((function() { alert(this); }).call({}), 0); //object -
Anonymous function's contexgt
var name = "window"; var f = (function() { alert(this.name); }); f(); //window f.name = "local"; f(); //still window, the function still run in the context of window f.call(f); //local -
== vs ===
Here is the msdn documentation
Equality (==, !=)
- If the types of the two expressions are different, attempt to convert them to string, number, or Boolean.
- NaN is not equal to anything including itself.
- Negative zero equals positive zero.
- null equals both null and undefined.
- Values are considered equal if they are identical strings, numerically equivalent numbers, the same object, identical Boolean values, or (if different types) they can be coerced into one of these situations.
- Every other comparison is considered unequal.
Identity (===, !==)
These operators behave identically to the equality operators except no type conversion is done, and the types must be the same to be considered equal.
Here is some test case writing in Qunit.
test("Equality test", function() { ok(1 == 1 && 'a' == 'a' && 1 == '1' && 0 == false && '' == false); ok(null == null, "null equals to null"); ok(null == undefined, "null equals undefined"); ok(undefined == undefined, "undefined equals undefined"); ok({} != {}, "different objects are unequal"); }); -
Overflow
This property is used to control the behavior of container in which its content expend over its content area. It is not used to control the behavior of container of the container of the content. Normally overflow will not happen because the container of content can expend vertically or horizontally. For text content is non-replaced elements, overflow horizontally will not happen because it can be wrapped into next line. But overflow overcritical y is possible. But for Replaced Elements it can overflow horizontally.
-
Horizontal Formating of block element
The "seven properties" of horizontal formatting are: margin-left, border-left, padding-left, width, padding-right, border-right, and margin-right. Padding and margin is set to 0 by default. Width is set to auto. This means the block element will try expend as much as possible into its containing content space. /p>