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?
A. NewOrder [-newProperty-] = -newProperty-
B. NewOrder. prototype. newProperty =-newProperty-
C. this.NewOrder. newProperty = -newProperty-
D. NewOrder. newProperty = -newProperty-
Explanation:
References:
http://www.w3schools.com/js/js_object_prototypes.asp
Correct is B.
https://www.briefmenow.org/microsoft/which-line-of-code-should-you-use-86/
8
1
Link given in answer explanation explains that you cannot add property to object constructor in this case object constructor is NewOrder.
So statement this.NewOrder. newProperty = “newProperty” is INVALID.
CORRECT ANSWER IS ‘B’
http://www.w3schools.com/js/js_object_prototypes.asp
10
1