vendredi 2 juillet 2021

array javascript loop wrong

it´s a simple question but i can´t solve. Always when i tray to do loopp in my array return index 0

<script>
            let status = [];
            let number = [];
            let llamadas = [];
            
            llamadas = {!! json_encode($estados) !!}
            
            for(var i=0; i<llamadas.length; i++){
                console.log(llamadas[i][i]);

                status.push(llamadas[i][i].desc);
                number.push(llamadas[i][i].total)
            }

llamadas its my varaible from controller, i´m working with laravel 5.6 how backend

llamadas contain this:

(7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
0: {id_teleoperadora: 9, desc: "APLAZADA", total: 40}
1: {id_teleoperadora: 9, desc: "AUSENTE", total: 132}
2: {id_teleoperadora: 9, desc: "CONFIRMADA", total: 218}
3: {id_teleoperadora: 9, desc: "NUEVA", total: 101}
4: {id_teleoperadora: 9, desc: "NULA", total: 217}
5: {id_teleoperadora: 9, desc: "PENDIENTE", total: 45}
6: {id_teleoperadora: 9, desc: "VENTA", total: 1}
length: 7
__proto__: Array(0)

and his original content content wihtout for

[Array(7)]
0: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
length: 1
__proto__: Array(0)

never i show one array for this way

in push i need extract desc for to build to stadictics with chart.js. now i can return only one state. I don´t know that i´m doing wrong. when i have status i will continue with number but now only i can return one result status "aplazada" i don´t know if i´m doing well my pushs

thanks for help



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire