Quick question about JS files

There is any code that should be on the first lines in a JS file? i keep seeing this kind of code in the Data Visualization Projects but im not sure why and what it does? Is a JS coding convention thing?

var projectName="scatter-plot";
localStorage.setItem('example_project', 'D3: Scatter Plot');

CodePen is a pretty limited development environment.
As you further explore your learning, you’ll start to learn about node.js and the package.json file - which allows you to set the name of a project and the name of its author (among other things).

I think setting the project name like this is just to show you the project name, without using a package.json file.

1 Like