---
id: 68b7687dded630607aceccb3
title: "Challenge 49: CSV Header Parser"
challengeType: 28
dashedName: challenge-49
---

# --description--

Given the first line of a comma-separated values (CSV) file, return an array containing the headings.

- The first line of a CSV file contains headings separated by commas.
- Remove any leading or trailing whitespace from each heading.

# --hints--

`getHeadings("name,age,city")` should return `["name", "age", "city"]`.

```js
assert.deepEqual(getHeadings("name,age,city"), ["name", "age", "city"]);
```

`getHeadings("first name,last name,phone")` should return `["first name", "last name", "phone"]`.

```js
assert.deepEqual(getHeadings("first name,last name,phone"), ["first name", "last name", "phone"]);
```

`getHeadings("username , email , signup date ")` should return `["username", "email", "signup date"]`.

```js
assert.deepEqual(getHeadings("username , email , signup date "), ["username", "email", "signup date"]);
```

# --seed--

## --seed-contents--

```js
function getHeadings(csv) {

  return csv;
}
```

# --solutions--

```js
function getHeadings(csv) {
  return csv
    .split(",")
    .map(h => h.trim());
}
```
