PrepAway - Latest Free Exam Questions & Answers

Which three actions should you perform in sequence to complete the implementation?

DRAG DROP
You have the following code:

The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
Create an object that represents an image that will be displayed.
Set the image properties from the values that are returned by the web service.
Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation? (Develop the
solution by selecting the required code segments and arranging them in the correct order.)

PrepAway - Latest Free Exam Questions & Answers

Answer: See the explanation.

Explanation:

Box 1: var img = document.createElement(‘img’);
Box 2: img:alt = image.Description;
img src = image.FileName;
Box 3: return this.img;

Note:
* Image Object
The Image object represents an embedded image.
For each <img> tag in an HTML document, an Image object is created.
Notice that images are not technically inserted into an HTML page, images are linked to HTML pages.
The <img> tag creates a holding space for the referenced image.
* Image Object Properties include
alt, Sets or returns the value of the alt attribute of an image
src, Sets or returns the value of the src attribute of an image

10 Comments on “Which three actions should you perform in sequence to complete the implementation?

      1. Phil says:

        retun this.img is wrong coz this.img is not defined at that point. It also doesn’t ask to return the image. You should expose it within the PersonImage object which you do with this.img = img;

        Cheers




        0



        0
  1. Franco2000 says:

    Agreed. I made a html page including the “this.img = img” code and it works, if you use “return this.img” it fails.

    Correct answer–> this.img = img




    0



    0
    1. Umer Khalid says:

      Because as per the question statement we are supposed to CREATE an image object first and then EXPOSE it as property of the PersonImage object. So as per my understanding following answer is correct:

      var img = document.createElement(‘img’);
      img.alt = image.Description;
      img.src = image.FileName;
      this.img = img;




      1



      0

Leave a Reply