- A Rahul 30000
- B Rahul
- C Rahul 45000
- D v
- Share this MCQ
Answer:
C
Share this MCQ
Click me to Read more Question & Answer of Javascript Classes MCQThe emp function is defined as a constructor function that takes two arguments: name and salary. The name and salary properties of the object are set using the this keyword. The changeSalary method is defined and assigned to the changeSalary property of the object using the this keyword. The changeSalary method takes a single argument: otherSalary. An object is created using the emp constructor function and passing it the arguments "Rahul" and 30000. This creates an object with the name property set to "Rahul" and the salary property set to 30000. The changeSalary method is called on the object, passing it the argument 45000. This sets the salary property of the object to 45000. The name and salary properties of the object are written to the document using the document.write() method. The output is e.name+ 45000. The changeSalary method uses the this keyword to refer to the current object and sets the salary property of the object to the value of the otherSalary argument. This allows you to change the salary of the object by calling the changeSalary method and passing it a new salary value
Share this MCQ