title: What is the importance of prototype in this example?
body: <p>I found this example in w3school related to topic &quot;Prototype&quot; in js. My question is that we can do the same with creating simple function then what is the importance of prototype. Can anyone explain.Thanx in advance.</p>
  <pre><code>&lt;button type=&quot;button&quot; onclick=&quot;doSomething()&quot;&gt;Click Me&lt;/button&gt;
  </code></pre>
  <h1>JS</h1>
  <pre><code>function doSomething(){
      var fruits=[&quot;apple&quot;,&quot;banana&quot;,&quot;papaya&quot;]
      console.log(fruits)
      fruits.uCase()
      console.log(fruits)
  }
  
  Array.prototype.uCase=function(){
    for(var i=0;i&lt;this.length;i++){
          this[i]=this[i].toUpperCase();
      }
  }
  </code></pre>