capitalizeString is a function here or just a constant variable

const = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}
const foo = “bar”;
export { capitalizeString, foo }

Incorrect syntax, you need to give things names:

const someVariableName = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}

Not

const = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}

You’re assigning a function to a variable, once you fix the syntax someVariableName references a function, so its effectively the same as writing function someVariableName (string) {

1 Like