Espen
KPCKevin Powell - Community
•Created by Brightie on 7/27/2023 in #front-end
Which is the better option?
I don't think there is a huge difference in performance (someone please correct me if I am wrong). Still, I think it would be cleaner to have that much data stored in a separate JSON-file.
One way to do that is to create a .JSON file in VS-code, say you call it data.json. If you want to use it in a JavaScript-file, you can start that file with the line
const myData = require("./data.json");
You should now be able to access any information from the data.json-file using the variable myData in your JavaScript-file.
9 replies