Uncaught (in promise) TypeError: data.map is not a function [closed]

I get data from a csv file but it got error: “Uncaught (in promise) TypeError: data.map is not a function”

d3.csv("http://127.0.0.1:8887/data.csv", function(data) {
      xScale.domain(data.map(function(d) {
        return d.year;
      }));
      yScale.domain([0, d3.max(data, function(d) {
        return d.value;
      })]);

      g.append("g")
        .attr("transform", "translate(0," + height + ")")
        .call(d3.axisBottom(xScale));

      g.append("g")
        .call(d3.axisLeft(yScale).tickFormat(function(d) {
          return "$" + d;
        }).ticks(10));

Can someone help to solve this issue?