0

I try to push the record in an array in specific position

My array :

var days= [
                {
                   "num": "All",
                   "value": "-1",
                },
                {
                    "num": 100,
                    "value": "100"
                },
                {
                    "num": 101,
                    "value": "101",
                },
                {
                   "num": 99,
                   "value": "99",
                },
                {
                   "num": "Load More",
                   "value": "Load More",
                },
                ]
        
        
        

I try to push new record in the array ( 45) when i push the record in the array it was reflected after load more record (last index ) . I need to push in second index of the array (After ALL value)

Expected results :

var days= [
            {
               "num": "All",
               "value": "-1",
            },
            {
                "num": 45,
                "value": "45"
            },
            {
                "num": 100,
                "value": "100"
            },
            {
                "num": 101,
                "value": "101",
            },
            {
               "num": 99,
               "value": "99",
            },
            {
               "num": "Load More",
               "value": "Load More",
            },
            ]
     
        
        
John Ken
  • 898
  • 1
  • 13
  • 26

0 Answers0