Answers for "Reverse an array java script"

21

reversing an array in js

var arr=[1,2,5,6,2]
arr.reverse()
Posted by: Guest on June-26-2020
5

reverse array javascript

const list = [1, 2, 3, 4, 5];
list.reverse();
Posted by: Guest on August-28-2020
1

Reverse an array java script

import React, { Component } from 'react';

export default class Slideshows extends Component {
    constructor(){
        super();
        this.state = {
            data:[
                { "id": "1", "name": 'Robert', "age": "21" },
                { "id": "2", "name": 'Sam', "age": "33" },
                { "id": "3", "name": 'Jerry', "age": "42" },
            ]
        }
    }
    render() {
        const reverseData = this.state.map((data, i) => {
            return (
                <li> {data.name} | {data.age} </li>
            )
        })
        return (
            <ul>
                {reverseData}
            </ul>
        )
    }
}
Posted by: Guest on June-10-2021

Browse Popular Code Answers by Language