1. The last statement of each function must be a return statement. True False 2.
ID: 3917878 • Letter: 1
Question
1.
The last statement of each function must be a return statement.
True
False
2.When the ______ statement is executed, the variable or expression is evaluated and the resulting value is returned as the output of the function
3.What is a function library?
4.Suppose some functions have been entered into a local file named "income.js". Write the correct SCRIPT tag to load the library to a Web page.
5.How to define a function library and use the library from other Web pages?
6.
The Mosteller Formula is often used by doctors to estimate the surface area of a person's body given height and weight. The formula is as follows, where hight is assumed to be in centimeters, weight is in kilograms, and surface is in square meters:
Write a function named as getSurfaceArea, which takes height and weight as parameters, calculates and returns the surface area by applying the above Mosteller Formula.
7.
Define a function named as calcAverage, which takes score1, score2, and score3 as parameters, calculates and returns the average of the three scores.
8.
What's wrong with the following HTML document?
Explanation / Answer
I assume that all the questions are related to javascript only.
1. False : You don't necessarily have to add a return statement if the funtion is defined such that it returns void.
2. The answer is 'return' statement. Return statement calcuates the expression and returns to the place of function call with the calculated value as output.
3. A library is a piece of pre-written code with some useful functions which allows for easier development of applications, for exampe AJAX, Leaflet etc.
4. <script type="text/javascript" src="income.js"></script>
5. You can write all the functions and variable in a file with extension '.js' and save it in your project directory. Now, all you have to do is to import the file using script tag as specified in previous part.
6. Photo Missing
7.
8. Photo Missing
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.