<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>grazie<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Il 07/10/2016 07:27, Simone Bravo ha
      scritto:<br>
    </div>
    <blockquote
cite="mid:CAOqAoQsB4e8fzZb9hCfeXHbz4ukAa_s1Q-y=v_ZSOrGdAFHPuQ@mail.gmail.com"
      type="cite">
      <p dir="ltr">Se scrivi il nome di una funzione senza parentesi ti
        ritorna il corpo della funzione, spesso lo uso dalla console di
        Chrome se devo fare qualche prova senza dover modificare il
        codice</p>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">Il 06 ott 2016 21:59, "Mirko Prota"
          <<a moz-do-not-send="true" href="mailto:mirkos93@gmail.com">mirkos93@gmail.com</a>>
          ha scritto:<br type="attribution">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Ciao Jusi,
              <div>per chiamare la funzione "per" all'interno di rec,
                dovresti aggiungere un paio di parentesi:</div>
              <div><br>
              </div>
              <div><span style="font-size:12.8px"><script
                  language="javascript" type="text/javascript"></span><br
                  style="font-size:12.8px">
                <span style="font-size:12.8px">var r=new rec(7,4);</span><br
                  style="font-size:12.8px">
                <span style="font-size:12.8px">s="x="+r.x+"<br>y="+r.y+"<br>"</span><span
                  style="font-size:12.8px"><wbr>;</span><br
                  style="font-size:12.8px">
                <span style="font-size:12.8px">s+="area:"+r.area+"<br>perimet</span><span
                  style="font-size:12.8px"><wbr>ro="+r.per()+"<br>";</span><br
                  style="font-size:12.8px">
                <span style="font-size:12.8px">document.write(s);</span><br
                  style="font-size:12.8px">
                <span style="font-size:12.8px"></script></span><br>
              </div>
              <div><br>
              </div>
              <div>Ambiguo comunque il fatto che ti printi il testo
                della funzione..</div>
              <div><br>
              </div>
              <div>Ciao</div>
              <div>Mirko</div>
            </div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">Il giorno 6 ottobre 2016 21:35,
                Jusi Pomenti <span dir="ltr"><<a
                    moz-do-not-send="true"
                    href="mailto:jusipom@gmail.com" target="_blank">jusipom@gmail.com</a>></span>
                ha scritto:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">Ciao,<br>
                  <br>
                  scusate se  sono OT,ma ho un problema nella
                  definizione di oggetti javascript.Non avendoli mai
                  usati,ho scritto questo semplice  script per capire 
                  come funzionano gli oggetti in questo linguaggio:<br>
                  <br>
                  <script language="javascript"
                  type="text/javascript"><br>
                  function calcola_area(x,y)<br>
                            {<br>
                                 return x*y;<br>
                            }<br>
                  function rec(x,y)<br>
                      {<br>
                         this.x=x;<br>
                         this.y=y;<br>
                         this.area=calcola_area(this.x<wbr>,this.y);<br>
                         this.per=function()<br>
                                      { return 2*(this.x*this.y) };<br>
                      }<br>
                  </script><br>
                  <br>
                  richiamandolo cosi':<br>
                  <br>
                  <script language="javascript"
                  type="text/javascript"><br>
                  var r=new rec(7,4);<br>
                  s="x="+r.x+"<br>y="+r.y+"<br>"<wbr>;<br>
                  s+="area:"+r.area+"<br>perimet<wbr>ro="+r.per+"<br>";<br>
                  document.write(s);<br>
                  </script><br>
                  <br>
                  l'output che ottengo  è::<br>
                  <br>
                  x=7<br>
                  y=4<br>
                  area:28<br>
                  perimetro=function () { return 2*(this.x*this.y) }<br>
                  <br>
                  L'area viene calcolata bene ma da una funzione esterna
                  all'oggetto per cui non  rispetta la regola
                  dell'incapsulamento propria dell'OOP;<br>
                  <br>
                  La funzione "per",interna all'oggetto,dovrebbe  essere
                  il  modo corretto di definire un  metodo e dovrebbe
                  restituire 22 invece restituisce il  testo della
                  funzione stessa;perche'?<br>
                  <br>
                  Ciao e grazie<span class="m_2294721615237162198HOEnZb"><font
                      color="#888888"><br>
                      <br>
                      Jusi<br>
                      <br>
                      <br>
                      -- <br>
                      ------------------------------<wbr>-<br>
                      Junior Silvestro Pomenti<br>
                      Latina<br>
                      Email: jusipom(at)<a moz-do-not-send="true"
                        href="http://gmail.com" rel="noreferrer"
                        target="_blank">gmail.com</a><br>
                      ------------------------------<wbr>-<br>
                      <br>
                      ______________________________<wbr>_________________<br>
                      <a moz-do-not-send="true" href="http://www.llg.it"
                        rel="noreferrer" target="_blank">http://www.llg.it</a><br>
                      latina mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:latina@lists.linux.it"
                        target="_blank">latina@lists.linux.it</a><br>
                      <a moz-do-not-send="true"
                        href="https://lists.linux.it/listinfo/latina"
                        rel="noreferrer" target="_blank">https://lists.linux.it/listinf<wbr>o/latina</a><br>
                    </font></span></blockquote>
              </div>
              <br>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            <a moz-do-not-send="true" href="http://www.llg.it"
              rel="noreferrer" target="_blank">http://www.llg.it</a><br>
            latina mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:latina@lists.linux.it">latina@lists.linux.it</a><br>
            <a moz-do-not-send="true"
              href="https://lists.linux.it/listinfo/latina"
              rel="noreferrer" target="_blank">https://lists.linux.it/<wbr>listinfo/latina</a><br>
            <br>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
<a class="moz-txt-link-freetext" href="http://www.llg.it">http://www.llg.it</a>
latina mailing list
<a class="moz-txt-link-abbreviated" href="mailto:latina@lists.linux.it">latina@lists.linux.it</a>
<a class="moz-txt-link-freetext" href="https://lists.linux.it/listinfo/latina">https://lists.linux.it/listinfo/latina</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
-------------------------------
Junior Silvestro Pomenti
Latina
Email: jusipom(at)gmail.com
-------------------------------</pre>
  </body>
</html>