title: How can I calculate part in percentage for every user using loop for?
body: <p>I have two arrays here. One of projects and other for lead. Every project have idLead like foreign key. I already created some functions and they are working fine. I want now just to loop on lead to know the  part of every lead in projects. I mean how many projects has every  lead in %?</p>
  <pre><code>  ngOnInit(): void {
      // This is intentional
  
      this.SumOfLead();
      this.SumOfProjet();
      this.ProjetParAnnee('2020');
      this.leadParAnnee();
      this.LeadProjetSum('2');
    }
  </code></pre>
  <pre><code>  leadList: any = [
      { id: '1', libelle: 'Vector', anneeCreation: '2020' },
      { id: '2', libelle: 'Salim', anneeCreation: '2021' },
      { id: '3', libelle: 'Antoine', anneeCreation: '2020' },
      { id: '4', libelle: 'Eya', anneeCreation: '2022' },
      { id: '5', libelle: 'Juliette', anneeCreation: '2021' },
      { id: '6', libelle: 'Anna', anneeCreation: '2021' },
    ];
  
    projetList: any = [
      {
        id: '1',
        libelle: 'EcoleVector',
        anneeCreation: '2021',
        idLead: '1',
      },
      { id: '2', libelle: 'Aramex', anneeCreation: '2021', idLead: '2' },
      { id: '3', libelle: 'SpeedFood', anneeCreation: '2021', idLead: '4' },
      { id: '4', libelle: 'Jumia', anneeCreation: '2022', idLead: '1' },
      { id: '5', libelle: 'Amazon', anneeCreation: '2020', idLead: '5' },
      { id: '6', libelle: 'AliBaba', anneeCreation: '2022', idLead: '6' },
      { id: '7', libelle: 'TikTok', anneeCreation: '2021', idLead: '3' },
      { id: '8', libelle: 'Teskerti', anneeCreation: '2022', idLead: '2' },
    ];
  </code></pre>
  <pre><code>  SumOfLead() {
      let nombreLead = this.leadList.length;
      console.log(nombreLead, 'nombre de leads');
    }
  
    SumOfProjet() {
      let nombreProjet = this.projetList.length;
      console.log(nombreProjet, 'nombre de projets');
    }
  
    ProjetParAnnee(annee: string) {
      let filteredProjet = this.projetList.filter(
        (list: any) =&gt; list.anneeCreation === annee
      );
      console.log(filteredProjet, 'projets  crées en 2020');
    }
  
    leadParAnnee() {
      let annee = '2021';
      let filteredLead = this.leadList.filter(
        (lead: any) =&gt; lead.anneeCreation === annee
      );
      console.log(filteredLead, ' nombre de  lead crées  en  2021');
    }
  
    LeadProjetSum(id: any) {
      let nombreProjet = this.projetList.length;
      let SumProjetForOneLead = this.projetList.filter((sum: any) =&gt; sum.idLead === id);
      let part = (SumProjetForOneLead.length * 100) / nombreProjet;
      
  
      console.log(
        SumProjetForOneLead.length,
        'nombre de projet  par lead ',
        'part=',
        part + '%'
      );
    }
  </code></pre>