PrepAway - Latest Free Exam Questions & Answers

How should you complete the relevant code?

DRAG DROP
You are developing an application by using JavaScript.
You must write a function that returns the sum of the variables named v1, v2, v3, v4.
You need to complete the sum function.
How should you complete the relevant code? (To answer, drag the appropriate code segment or segments to
the correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
* What is the difference between call and apply?
apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly.
Pseudo syntax:
theFunction.apply(valueForThis, arrayOfArgs)
theFunction.call(valueForThis, arg1, arg2, …)
What is the difference between call and apply?

One Comment on “How should you complete the relevant code?


Leave a Reply