What will be the output of the following JavaScript code? [code] var emp=new Object(); emp.name="Ravi Malik"; emp.salary=50000; document.w

What will be the output of the following JavaScript code?
Code:
var emp=new Object();  
emp.name="Ravi Malik";  
emp.salary=50000;  
document.write("emp.name+" "+emp.salary);
A. Ravi malik 5000
B. Ravi Malik 50000
C. Ravi malik
D. 50000
 
Answer: b
Explanation: In the above code an object of class emp is made using the new operator. The above code prints the value of name and salary as defined in the object of the class.
 

Tìm kiếm

Back
Top