Java Script

Java script functions are pieces of codes used to execute commands in a program whenever they are called to do so. Java script functions enable the reusability of commands, passing argument and value return in the program. This paper discusses functions as used in Java script as a programming language.

In Java script, functions are defined as pieces of codes with specific duties that must be called up or referenced before they perform this function. Prior to their referencing, the codes sit in a dormant mode without any function. Functions can also be defined as collection of names or value pairs with hidden links to prototype object.  One major use of functions in Java script is in repetitive tasks such as calculations, thus, they highly exhibit an element of reusability. Some programmers sometime call functions as constructors or arrays.  

Functions are used in defining arguments passed down to them by the programmer when the function is called (Resig, 2006). The result of the argument from the function depends on the kind of arguments that are given to the function. Functions can take more than one argument. Additionally, functions allow for augmenting object prototype to be available to other functions. Augmenting a function prototype makes this method to be available to all other functions.

According to Crockford (2008), there exist no explicit distinction between a method and a function in Java script. However a slight distinction can be said to occur during the process of calling where the function is called as a method. During this calling, the function’s local this keyword is completely immersed into the object for the call. A function stored as a property of a function may be referred to as a method. Unlike functions, there are several methods used in Java script during the process of calling.

According to Crockford (2008), a built-in function is the primary function that is called upon during the process of calling, whereas a programmer-defined function can rest within a built-in function and its function depends on the work that the programmer wants it to perform. On the other hand, Juneau &  Baker (2010) identified List, dictionaries, and sets as some of the constructs used with Python. According to them, dictionaries provide meta-information that identifies the author while sets provide module related information. Python constructs, on the other hand, may be considered as functions depending on the way they are used in a program.

Order now

Related essays