How to get Index and Value of array element using For-In loop in JavaScript

 


In ForIn loop,

<script>
    let feildsArr = ['offer', 'warr', 'size', 'color', 'highlight', 'payops', 'services']
    for (const key in feildsArr{
        console.log(key);
        console.log(feildsArr[key]);
    }
</script>



Post a Comment

Previous Post Next Post