Debugging single JS file with function with VS Code

I’ve single javascript file with below code

const twoFer = (name) => {
  //throw new Error('Remove this statement and implement this function');
  console.log("test");
  return (name !== undefined ? `One for ${name}, one for me.` : "One for you, one for me.");
};

console.log(twoFer("test 123"));

When I debug by clicking Run and Debug icon on left of VS Code , start debugging button against Launch Chrome, nothing is shown in

  • DEBUG CONSOLE
  • debug Chrome browser console

What’s going wrong here ?

Thanks,
Vikram

are you running this code in nodeJS env or are you inserting this script inside HTML file?

Cause if you’re doing the latter then make sure that you’ve properly inserted the script

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.