how to run js file in vs code

JavaScript
Simply open the .js file in question in VS Code, 
  switch to the 'Debug Console' tab, hit the debug button 
  in the left nav bar, and click the run icon (play button)!// install live server and then right click on your index.html and the keep the browser ready
Source

Also in JavaScript: