Question about Javascript


#1

How do I get console.log to work through a program like Notepad++? I have to use document.write. Is there a way to get a console?


#2

@quobogeba You'll need to use your browser console to view text logged to the console. On many computers, you can use either F12 or Shift+Ctrl+I to access the browser developer tools, and from there you can click the “Console” tab to see console output :slight_smile:


#3

Thank you :slight_smile:


#4

Ctrl+Shift+J for Chrome developer console :slight_smile:


#5

What about for Safari or MacOS?
Edit: as soon as I posted this, I found the answer

in the menu bar, choose Safari > Preferences, click Advanced, then select “Show Develop menu in menu bar.”


#6

In Notepad++ click Run and choose a browser. The file has to be saved to run, save it first. Right click the new browser window and select 'Inspect element' which is present in most browsers.

The HTML representation will be given, along with the style rules that apply to the element. From here click Console in the menu and there you will see any error messages that occured at load time or run time. And, of course, any logging that was done by your program.

F5 the browser window to reload and run the script again.