- 浏览: 399696 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
Javascript is a dynamic type function. you cannot do something like reflection in other strong langauge.
though you cannot do something like typeof(obj), while you can test if a function is the contructor that cretaed the object.
basically you can test if a function is the constructor to an object by two ways
- obj isinstanceof Functin
- obj.contructor == Function
below is the html file that shows you have to do that.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" src="../unit.js"></script> <script type="text/javascript"> function Ninja() { } var ninja = new Ninja(); window.onload = function () { test("object type test", function () { assert(typeof ninja == "object", "However the type of the instance is still an object."); assert(ninja instanceof Ninja, "The object was instantiated properly."); assert(ninja.constructor == Ninja, "The ninja object was created by the Ninja function"); var ninja2 = new ninja.constructor(); assert(ninja2 instanceof Ninja, "Still a ninja object."); }); }; </script> <style type="text/css" > #results li.pass { color: Green } #results li.fail { color: Red } </style> </head> <body> <ul id="results" /> </body> </html>
发表评论
-
javascript - trick to cross browser DOM ready event
2012-08-24 08:23 927the "ready" event ... -
javascript - trick to simulate mouseenter and mouseleave
2012-08-23 08:31 2254Previously we discussed javasc ... -
javascript - trick to simulate the change event
2012-08-22 08:51 1659In the previous discussion a ... -
javascript - trick to simulate bubbling submit event
2012-08-22 08:03 906In the previous discussion abou ... -
javascript - trick to implement bubbling submit event
2012-08-23 07:55 700Following up to the javascrip ... -
javascript - trick to detect bubbling supportability
2012-08-20 22:22 971Event delegation is oe of the b ... -
javascript - trigger event and custom events
2012-08-20 21:58 2078In the previous post - javascri ... -
javascript - trick to handlers management
2012-08-20 08:19 1024We have discussed "javascr ... -
javascript - trick to centralized store
2012-08-20 07:52 818For a number of reasons it's ... -
javascript - trick to fix the event object
2012-08-20 07:47 880Many browsers, especially In ... -
javascript - tricks to deal with colors
2012-08-15 08:34 766There are a couple of ways to r ... -
javascript - trick to manipulate the opacity
2012-08-15 08:26 765All other browsre may have supp ... -
javascript - trick to test visibility of an element
2012-08-15 08:15 521though there is a visible prope ... -
javascript - trick to get and set height and width
2012-08-15 08:05 548when looking at properties t ... -
javascript - trick to set/get attributes that expects px values
2012-08-16 11:00 516When setting a number into a ... -
javascript - trick to get and set CSS style
2012-08-16 11:00 747while it will not be so much tr ... -
javascript - trick to normalize href for IE
2012-08-16 10:59 533IE is again the only browser th ... -
javascript - trick IE form and its expando attribute
2012-08-16 10:59 1041there is a known issue that if ... -
javascript expando and attributes
2012-08-14 08:15 1038expando is something like this ... -
javascript - trick to getText and setText
2012-08-14 07:40 1144it is not as simple as you thin ...
相关推荐
of the BZ reaction to simulate the evolution of these spirals. The models typically use cellular automata to allow progression of a wavefront through a notional substrate. Usually a single substrate ...
We introduce the noise level function (NLF), which is a continuous function describing the noise level as a function of image brightness. We then estimate an upper bound of the real NLF by fitting a ...
this heritage of the craft is going to arm you with some of the right tools to make a diference in your daily work. The craft of graphic design has changed little in the past fifty years. We’re ...
Use QuickSort algorithm to sort the array S that has n elements and constructed by the random() function. To compare the result with ones solved by other sorting algorithms, such as Straight selection...
that is, the other objects they work with, only through constructor arguments, arguments to a factory method, or properties that are set on the object instance after it is constructed or returned ...
Through the authors' carefully constructed explanations and examples, you will develop an understanding of Swift grammar and the elements of effective Swift style. This book is written for Swift 3.0 ...
For example, a syntax chart might show how the various parts of a function definition in Ada fit together. #### Conclusion EBNF is a fundamental tool in the field of programming and compiler design...
- **Constructed Types**: Explains the construction of complex data types. - **Variants**: Specifies different variants of data types. - **Cryptographic Attributes**: Details attributes related to ...
Chapter 7Tokens, Values, and Variablesdescribes the tokens of the language from which statements are constructed, the types defined by the language and their allowed values, and the variables that ...
control method attempts to create 2 objects of the same name. This once again returns AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that will dynamically serialize the ...
A graphsearch method to illustrate exhaustive results to the desired information based on the constructed knowledge graph is proposed. A case of a 500 kV station example is then demonstrated to show ...
The purpose of this book is to teach the C programming language, using examples running on the JumpStart MicroBox hardware. A college-level course syllabus can be constructed around this book and its ...
The simulation for the system constructed with the help of MATLAB/SIMULINK. The SPWM method improves the efficiency and reduces the total harmonics distortion in the output voltage.
neural network are constructed to solve the Hamilton-Jacobi-Bellman (HJB) equation. The error tracking system of AUV is guaranteed to be uniformly ul- timately bounded (UUB) based on the Lyapunov ...
of a nonlinear program (NLP) local solver that generates a KKT point of the constructed approximation to PCDP at each iteration if this problem is indeed feasible; (ii) existence of a Slater point of ...
Written by a Silicon Graphics X Window System and OpenGL expert, OpenGL Programming for the X Window System uses the OpenGL Utility Toolkit (GLUT) to show how OpenGL programs can be constructed ...
constructed to represent the 3D moving trend feature in spatial domain. The geometry information of joints in each frame is modelled by the relative motion with the initial status. The proposed ...