Attempting to generate a package.json
with node and it works if I define the function like this:
const generatePackageJson = (name) => {
const package =
`
{
"name": "${name}",
}
`;
return package;
}
The package
string returned contains the name parameter. However doing this does not work:
const generatePackageJson = (name) => {
return
`
{
"name": "${name}",
}
`;
}
The result returned is undefined
. Just curious as to why this is?