I am a beginner in Javascript. I hope to get some help.

I built a local server using MAMP, and all my files are local. I want to read a value from a json file. This json file(data.json) has only one item `{"type":2}`, and I only want to use the value(2 in this case). But the value of "type" changes, so Javascript should read it constantly and maybe save it into a var in Javascript.

Can I listen for changes to that file so that I can be sure I always have the most up to date value for type?

I am still not familiar with Javascript. I would really appreciate it if you could give me some specific codes or examples.