answer of following questions 1What is a function and briefl
answer of following questions??
1.What is a function and briefly discuss the need for functions in any language?
2.Comment on the modularity and reusability of balanceUp and balanceDown functions.
3.How do you send and receive data back to and from functions.
Solution
1)
Functions are very much used in computer languages and spreadsheets. Recall that a function takes an input , does some calculations on the input, and then gives back a result. In computer programming they are a very similar idea, with a few changes to naming and properties.
A function in a programming language is a program fragment that \'knows\' how to perform a defined task. For example a function may be written that finds the average of three supplied numbers. Once written, this function may be used many times without having to rewrite it over and over.
2) Modularity means code is generated for a given macro (i.e., composite) block independently from context, that is, without knowing where this block is to be used, and also with minimal knowledge about its sub-blocks.Modularity works by isolating code from it\'s global context. whereas reusability is a process which they can use the code for many times in many ways sothat it balances at some where according to the execution.
3) The only way to return the data from the function would be to make a synchronous call instead of an asynchronous call, but that would freeze up the browser while it\'s waiting for the response.
