'How to get correct Data from Array of arrays

I have following function in react.

const [dataTemperature, setDataTemperature] = useState();

 useEffect(() => {
      let newData = [];
       function lineChart (arg){
          const loop = arg.map((value) => {
              return Math.round(value.main.feels_like - 273.15);
            })
            newData.push(loop);
          };

          let xAxis = newData.sort();
          console.log("xAxis", newData[1])
          let xAxis2 = [...new Set(xAxis)]

            setDataTemperature(newData)
          lineChart(state.fromTemperature.list)
        },[])
         

enter image description here

I am getting some data as a props (state.fromTemperature.list this is array of objects), I map this through this in loop function to get only value and I push this value to newData. I expect this to be simple array where I can use array methods to sort it and remove duplicates. But It didn´t work. I check the type of newData and It show that it is object. I think now it is array of array but I am not sure. In a case it is something like this should work

 let xAxis = newData.map((x)=> x.sort((a, b)=> {return a-b}));

but it doesn´t. Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source