Question: I want to insert a date into my H2 database using a sql script. Now I have the following:

```
CREATE TABLE CUSTOMERS (
  ID int NOT NULL,
  FIRSTNAME varchar(50) NOT NULL,
  LASTNAME varchar(50) NOT NULL,
  GENDER varchar(50) NOT NULL,
  COMPANYID varchar(50) NOT NULL,
  EMAIL varchar(50) NOT NULL,
  BIRTHDAY date NOT NULL,
  CREATEDAT date NOT NULL,
  UPDATEDAT date NOT NULL,
  PRIMARY KEY (ID)
);
INSERT INTO CUSTOMERS (
  ID,
  FIRSTNAME,
  LASTNAME,
  GENDER,
  COMPANYID,
  EMAIL,
  BIRTHDAY,
  CREATEDAT,
  UPDATEDAT
)
VALUES (
  1, 
  'Lee', 
  'Diaz', 
  'male', 
  '159', 
  'vel.sapien.imperdiet@protonmail.ca', 
  '05-08-1912', 
  '13-12-2019', 
  '30-09-2021'
)

```

For some reason the dates don't work, but I don't get why. Does anyone know?

Answer: 
Just split on the space character.

```js
function convertNameToObject(string) {
    const [firstName, lastName] = string.split(" ");
    return { firstName, lastName };
}
console.log(convertNameToObject("Harry Potter"));
```
Little improved version that originally was provided by @Samathingamajig.

In the body of function there is IIFE expression.

```js
function convertNameToObject(string) {
    return (([firstName, lastName]) => ({firstName, lastName}))(string.split(" "))

}
console.log(convertNameToObject("Harry Potter"));
```