nerdexam
Microsoft

98-375 · Question #64

You write the following JavaScript code. (Line numbers are included for reference only.) You need to write a function that will initialize and encapsulate the member variable full name. Which are…

The correct answer is B. Option B D. Option D. In JavaScript this always refers to the "owner" of the function we're executing, or rather, to the object that a function is a method of. - If you assign a value to variable that has not yet been declared, the variable will automatically be declared as a GLOBAL variable…

Understanding JavaScript

Question

You write the following JavaScript code. (Line numbers are included for reference only.) You need to write a function that will initialize and encapsulate the member variable full name. Which are two possible code fragments you could insert at line 02 to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D

How the community answered

(51 responses)
  • A
    6% (3)
  • B
    80% (41)
  • C
    14% (7)

Explanation

  • In JavaScript this always refers to the "owner" of the function we're executing, or rather, to the object that a function is a method of. - If you assign a value to variable that has not yet been declared, the variable will automatically be declared as a GLOBAL variable. carname="Volvo"; Will declare the variable carname as a global variable , even if it is executed inside a function.

Topics

#encapsulation#closures#member variables#OOP

Community Discussion

No community discussion yet for this question.

Full 98-375 Practice