Mar 21 in JavaScript
Q: Which one of the following is correct output for the following given JavaScript code:

functionoutputfun(object)  

{  

    var place=object ?object.place: "Italy";  

    return "clean:"+ place;  

}  

console.log(outputfun({place:India}));  

a) Error

b) clean:Italy

c) clean:India

d) undefined

1 Answer

0 votes
Mar 21

Answer: C

Reason: In the following given code, the "?" ternary operator is used for comparing the values and place is determined (or initialized) according to the true condition that whether it returns true (1) or false (0).

Related questions

0 votes
Mar 23 in JavaScript
0 votes
Mar 21 in JavaScript
...