All of you, this is John Racing's # 23 from Advanced Javascript, which
< Code> What will happen if there is a function object property
1) About the terminology, the variable is the cutting object, right? If the anonymous function is its property, then what is called "use"? I thought "usage" is also called property? Or "object" is also an object because there is a value in it, namely a function?
2). What is the purpose of changing the function SHRP: True SHRP: is wrong? What does this!
3) When it claims! Katiana.Sister, what is this really saying? Is that SHRP now set to "false"?
var katana = {isharp: true, use: function () {this.isSharp =! This.isSharp; }}; Katana.use (); Life! (Katana. ISHRPP, "Confirm the value of SSRP has changed.");
Yes,
katana Created by using an object (
{...} notation). "Usage" is the name of the asset's property whose value will be an anonymous function (which is also an object).
The function
isSharp (from
true to
incorrect or
false to
true ).
It is saying that
isharp is something that does not evaluate the truth (this is almost
undefined , < Code> null ,
false ,
0 , etc.). In this situation, since
isharp is always a
true or
false , then it is emphasizing that it is
false Is.
The main point of the sample (and the cool part) is this line:
katana.use ();
This is the first time the value of the "use" property from the
katana object (it is
katana. It's part). The value is already an anonymous function, then that function is executed (it is
() part). In fact, the good part is that it is executed by
katana object - which means
this is the reference to the anonymous function
Kutana object when it is called like this.
Comments
Post a Comment