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.)

PrepAway - Latest Free Exam Questions & Answers

Answer:

8 Comments on “How should you complete the relevant code?

  1. Syed Ajaz Akhter says:

    function add(v1, v2)
    {
    return v1 + v2 + this.v3 + this.v4;
    }
    function addValue() {
    var o = { v3: 10, v4: 13 };
    var res = add.call(o,15, 3)
    document.getElementById(“results”).innerHTML = res;
    // return res;
    }




    1



    0
    1. suada says:

      that’s the right answer:
      function add(v1, v2)
      {
      return v1 + v2 + this.v3 + this.v4;
      }
      function addValue() {
      var o = { v3: 10, v4: 13 };
      var res = add.call(o,15, 3)
      return res;
      }




      0



      0

Leave a Reply