PrepAway - Latest Free Exam Questions & Answers

Which line of code should you use?

You are developing an application in HTML5.
You have the following code.

You need to add an additional property to the function definition.
Which line of code should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
NewOrder [“newProperty”] = “newProperty”

B.
NewOrder. prototype. newProperty = “newProperty”

C.
this.NewOrder. newProperty = “newProperty”

D.
NewOrder. newProperty = “newProperty”

Explanation:
http://www.w3schools.com/js/js_object_prototypes.asp

12 Comments on “Which line of code should you use?

      1. Diezvai says:

        As I understood – NewOrder is an object prototype, not existing object. If new object would be created (var myOrder = new NewOrder(1,01-01-2017 10:15); ) and that object needs new property, then yes – answer would be D.




        0



        0
  1. G says:

    I mean that the question is not clear. We can use prototype and normal object extension.
    If we use prototype the additional property is permanent, also for future object instances.
    If we use normal extensions the additional property is only for that object.




    0



    0

Leave a Reply