Why not fire the JavaScript console in Vs code?

let page = document.querySelector('.page');
page.classList.remove('light-theme');
page.classList.add('dark-theme');

let themeButton = document.querySelector('.theme-button');
themeButton.onclick = function () {
 console.log('Button pressed!'); 
};
No message is displayed in the console. What to do?
April 7th 20 at 15:18
1 answer
April 7th 20 at 15:20
Solution
Try that, and go to the console of the browser and not the editor.
With your code in my browser displayed, so it is working.
themeButton.addEventListener("click", function() {
 console.log('Button pressed!');
})
So in the browser, and I like to see in the editor console worked, but thanks anyway) - marcelina.Scho commented on April 7th 20 at 15:23
@Aracely.Nienow21, so in the editor the console is not a browser and the system. - Eden_Farrell57 commented on April 7th 20 at 15:26

Find more questions by tags JavaScriptVisual Studio Code