Home >Web Front-end >JS Tutorial >js alternative writing method_js object-oriented

js alternative writing method_js object-oriented

WBOY
WBOYOriginal
2016-05-16 19:05:421106browse


The implementation function is estimated to look like this:

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]

The code runs to test() Finally, you need to call the already written method E() and pass 2 parameters
one is the so-called ju of the object, the other is a newly written function

and then pass these two parameters to E () method, of course, the E() method is already waiting for parameters

What will it do when it waits for parameters that have not been seen for a long time... (To be continued)



Continued introduction:
As mentioned last time, the E() method saw the long-lost parameter ju and a function

Of course, E() is the transfer execution method of these two parameters. I called two younger brothers (variables a, b)
to quote everything from them. At this time,
a = ju
b = function(b)
{
b(a );
 if(a == "gyyy.")
 {
  b("G"); a); Let brother (variable c) get a , which is the length of ju referenced by a
, and then execute the function referenced by brother b passed to the E() method according to this length

and pass it 2 parameters are given to the function
, one is a[d], the other is d

Then, the execution of the little brother b is started, and now the little brother b is the function passed to the E() method at the beginning
And the function passed to the E() method accepts a parameter as shown on the right: function(b) { ... }

And the b in the function being executed now is from the E() method The passed a[d]


In other words: your mistake is in the passed a[d]. When executing b(a), a is determined by test() The
passed at the beginning and the b(a) executed is the a[d]
passed from the following E. In other words, a[d] is actually a method

I guess ju should be an array containing many methods
The principle is just like this, it’s a very troublesome thing, just to get access to a




[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute ]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn