title: store array into global variable angular
body: <p>I am trying to save the <code>value</code> of parse <code>array</code> into global <code>array</code>.
  but global <code>array</code> showing me <code>undefined</code></p>
  
  <pre><code>  dataUrl: string = "assets/data.csv";
    private data:[];
  dataInit(){
      this.papa.parse(this.dataUrl, {
        download: true,
        complete: (result) =&gt; {
          // result.data.push(this.data);
          this.data = result.data
          // console.log(result.data, "inside parser");
          // console.log(this.data, "global array");
        }
  
      });
    }
    ngOnInit() {
      this.dataInit();
      console.log(this.data, "inside onInit");
  }
  </code></pre>
  
  <p><strong>Console</strong></p>
  
  <p><code>undefined "inside onInit"</code></p>