You need to evaluate the value of the variable named customer.name

HOTSPOT
You troubleshoot a webpage that includes the following code segment:

You need to evaluate the value of the variable named customer.name.
For each statement in the table, select Yes if the code segment above causes the variable to evaluate
as described. Select No if it does not. Make only one selection in each column.

HOTSPOT
You troubleshoot a webpage that includes the following code segment:

You need to evaluate the value of the variable named customer.name.
For each statement in the table, select Yes if the code segment above causes the variable to evaluate
as described. Select No if it does not. Make only one selection in each column.

Answer:



Leave a Reply 9

Your email address will not be published. Required fields are marked *


Al

Al

Technically, null should be Yes as well:

http://jsfiddle.net/yrgq4zdb/

Valikhan

Valikhan

In your fiddle uses not strong type comparsion. Use strong comparsion (=== instead of ==) and you’ll recieve undefined – true.

Bilbo

Bilbo

I don’t understand this question. Rediculous question.

daniel12341231

daniel12341231

ejercicio

var customer = function () {
var name = “Contoso”;
return {
getName: function () {
return name;
},
setName: function (newName) {
name = newName;
}
};
}();

document.getElementById(“resultado”).innerHTML =
” ‘Contoso’ = ” + (customer.name === “Contoso”) + “” +
” undefined = ” + (customer.name === undefined) + “” +
” null = ” + (customer.name === null) + “” +
” false = ” + (customer.name === false);

resultado:

‘Contoso’ = false
undefined = true
null = false
false = false

es correcta la pregunta

J

J

the return part makes sure that the “name” property is private and not accessible using Customer.name.
It is only possible to get the name property by using customer.getName()

J

J

as such Customer.name is undefined.

strongmmc

strongmmc

I can’t seem to find any documentation explaining why this should be true.

Infact, as states in this link (http://www.crockford.com/javascript/private.html):

* Private members are made by the constructor.
* Ordinary vars and parameters of the constructor becomes the private members.
*
* function Container(param) {
* this.member = param;
* var secret = 3;
* var that = this;
* }
*
* This constructor makes three private instance variables: param, secret, and that

and being the variable ‘name’ defined inside the function as ‘var name’ this should be the reason why it’s private.

Can you give some reference for your assumption?

karthik

karthik

Thanks for your comments.Especially J you defined very well.thanks