Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Function objects and Type classes

Shulou Source: shulou.com Published: 2022-06-03 08:36:24 09月25日 Update

This article focuses on "how to use Function objects and Type classes". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn how to use Function objects and type classes.

Before we look at the Type class, let's first take a look at a very important object, which is the Function object. Function objects are internal objects of JavaScript, such as date objects (Date), array objects (Array), character objects (String), and (Object,RegExp,Math,Error, etc.). An object can be instantiated through new. In addition to our common functions declared by JavaScript, we can also build our function object in the following way: var myFunction=new Function (arguments,statement). Since I am not familiar with scripting, I am not familiar with prototype (but I heard that it is by giving a prototype object to indicate the type of object to be created, and then using the method of this prototype object to create more objects of the same type, and the original model schema belongs to the object creation mode), but after a simple test, if you extend Function to Function, you can declare the object through new and then reference him. You can also call Function. (method or function) If you use Function.uName directly to extend this uName, you can only call it through Function.uName, which reminds me of the static methods in .NET. With these, let's take a look at a few objects that extend Function in Asp.NET Ajax:

The code is as follows:

Function.__typeName= "Function"

Function.createCallback=function (bmaine a) {

Return function () {

Var e=arguments.length

If (e > 0) {

Var d = []

For (var caterpillar)

Tags: Objects functions methods instances interfaces spaces parameters arrays types static important names properties commonly used scripts learning content prototypes can be passed through characters Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn Apple Redmi Shulou Information