How can html return every piece of data inside the loop and keep it in its original format?

there is such a data:

se = [
{

name:"",
type:"scatter",
data:["0.085", "-0.013", ""]

},
{

name:"",
type:"scatter",
data:["0.077", "-0.025", ""]

}
]

        function BrandData(){
            for (var i=0;i<se.length;iPP){
                return {
                    name:se[i].name,
                    type:se[i].type,
                    data:se[i].data
                }
            }
        };

I want to return each item in this data through a loop and keep its original format, that is,
{name: "Honda", type: "scatter", data: ["0.085", "- 0.013", "Honda"]}

but I can"t get all the content. I can only get the first item. How can I get each item of data when I"m learning js, at work?

May.22,2021

use the return statement, execute the first loop, and of course exit the running environment of this function.
so, what exactly are you going to do when you get each piece of data

if you want to operate on every piece of data, forEach directly or use the callback function

se.forEach(item => {
    // do something
})

        function BrandData(){
            var arr=[];
            for (var i=0;i<se.length;iPP){
                arr.push( {
                    name:se[i].name,
                    type:se[i].type,
                    data:se[i].data
                } );
            }
            return arr;
        };
Menu