title: How to access variables inside a function from outside in another function in typescript?
body: <p>In my html page onchange, im just calling a method by passing parameters. After retrieving the value, onclick of another button Im calling function2. I need to use the variable from function in function2 in the same class. Im using angular 6 &amp; typescript. My ts file is given below.</p>
  
  <pre><code> export class component extends Lifecycle {
    cc1: string;
    constructor (){}
    Function (cc1,cc2)
    {
     this.cc1 = cc1;
     // return cc1;
     }
  
    Function2 (){
        console.log(cc1);
      }
    }
  </code></pre>
  
  <p>Can somebody help me with this?</p>