Why are functions treated differently in JavaScript? List some unique things that are possible with functions in JavaScript.

What will be an ideal response?


Functions are generally treated as blocks of code that execute a series of tasks or return a calculated value. However, almost everything in JavaScript is an object and functions are no different. The fact that functions are objects means that whatever can be done with a regular object can also be done with a function. Some of the unique things that can be done with a function in JavaScript are as follows:?• Storing a function as a variable• Storing a function as an object property• Using one function as a parameter in another function• Nesting one function within another function• Returning a function as the result of another function• Modifying the properties of a function?Because functions are objects, there are several ways of creating and saving the functions used in a JavaScript program.

Computer Science & Information Technology

You might also like to view...

Answer the following questions true (T) or false (F)

1. You can have a name spelled the same in two different namespaces with no conflict in your program. 2. You can use #define to define a name for a C++ variable.

Computer Science & Information Technology

The ________ property allows you to indent the first line of text in an element.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The Add Animation dialog box provides additional effects in which categories?

A) Entrance, Emphasis, Exit B) Exciting, Moderate, and Static C) Subtle, Exciting, and Modest D) Hyper, Static, and Basic

Computer Science & Information Technology

Write a program to copy text from the location pointed at by r0 to the location pointed at by r1. The copied version must be in reverse order. Assume the string you are copying is non?null (it contains at least one character) and that it is terminated.

What will be an ideal response?

Computer Science & Information Technology