PrepAway - Latest Free Exam Questions & Answers

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.

PrepAway - Latest Free Exam Questions & Answers

Answer:

9 Comments on “You need to evaluate the value of the variable named customer.name

  1. daniel12341231 says:

    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




    0



    0
  2. J says:

    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()




    1



    0
    1. strongmmc says:

      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?




      0



      0

Leave a Reply