Console - Reading Assignment

Hi @almanat,

Nice answers :ok_hand:

Just one comment…

Yes, we can change the contents of an HTML page there :+1: But this is a different developer tool.
In the actual console, we can do this by writing JavaScript code that accesses and manipulates the page’s Document Object Model (DOM).

2 Likes

Hi @Mining365,

Nice answers :ok_hand:

Just one comment…

Yes, we can change the contents of an HTML page there :+1: But the Elements tab is a different developer tool.
In the actual console, we can do this by writing JavaScript code that accesses and manipulates the page’s Document Object Model (DOM) .

1 Like

Hi @linlin00,

Nice answers :ok_hand:

Just to add to your Q4 answer…

… and more specifically, by writing JavaScript code that accesses and manipulates the page’s Document Object Model (DOM).

1 Like
  1. The console of your web browser Chrome or Firefox is used to execute Javascript commands

  2. Navigate to the menu at the top-right of browser window signified by three vertical dots in a row. Select More Tools then Developer Tools.

  3. it logs a value output

  4. by using the element tool in the console. However this will not be saved in the original HTML. Make sure to save any important changes in a html program

2 Likes
  1. What is the console used for?
    The console lets you write, manage, and monitor JavaScript on demand.
  2. How do you open the Console in Google Chrome?
    Click on the hamburger menu in the top right and select “More tools > Developer tools”. There you can select the console.
  3. What does console.log function do?
    It lets you input Javascript code and shows the output in the console. This is only used for development and debugging.
  4. How can you change the contents of an HTML page through the console?
    You can inspect the element you want to change by right clocking it and selecting “Inspect”.
1 Like

What is the console used for?

To write, manage and monitor JavaScript on demand via a web browser tools.

How do you open the Console in Google Chrome?

By clicking the three-dot icon located top right corner, then click more tools in the drop-down box, then developer tools in second drop down box.

What does console.log function do?

Analyse/debug/output values and data in real time within the console.

How can you change the contents of an HTML page through the console?

Any changes via the DOM console are not permanent, thou it’s a great way to test new ideas.

1 Like
  1. What is the console used for?
    “The console can be used to log information as part of the JavaScript development process, as well as allow you to interact with a web page by carrying out JavaScript expressions within the pages’s context. Essentially, the Console provides you with the ability to write, manage, and monitor JavaScript on demand.”

  2. How do you open the Console in Google Chrome?
    Google menu --> More tools --> Developer Tools --> Console tab (Ctrl+Shift+J on Windows)

  3. What does console.log function do?
    Allows us to work with JavaScript by logging it to the Console.

  4. How can you change the contents of an HTML page through the console?
    To change the body background color to light blue, for example, type: document.body.style.backgroundColor = “lightblue”;

1 Like

4. How can you change the contents of an HTML page through the console?

… and more specifically, by writing JavaScript code that accesses and manipulates the page’s Document Object Model (DOM) .

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like
  1. The console is used modifying & experimenting with Javascript elements within a webpage.
  2. CNTL, SHIFT, J opens the console in Chrome
  3. The console.log function allows a user to log into the console & parse javascript within the console interface
  4. You can change the contents of an HTML page through the console by programming script directly inside it.
1 Like

Hey everyone I am having an error on the final step of the assignment…

can anyone help please?

SyntaxError: redeclaration of let p

debugger eval code:1:1

let p = document.createElement(“P”); document.body.appendChild§; let t = document.createTextNode(“Paragraph text.”); p.appendChild(t);

Thank you in advance!

What is the console used for?

Debug webpages. Tryout javascript…

How do you open the Console in Google Chrome?

Ctrl + Shift + i shortcut or Inspect Element menu item in popup menu fired on webpage and go to Console Tab. My favorite is F12 key.

What does console.log function do?

Prints strings, return of functions. Helps us debug the facts and consequesnces out of code. In basic example of a usage: console.log("Hello, world!");
output: Hello, world.

console.log(2^2);
output: 4

console.log("2 times 0 = " + 2*0 );
output: 2 times 0 = 0

How can you change the contents of an HTML page through the console?

On the webpage, get to the content with mouse; right click; Inspect Element, then in Elements Console Tab double-click on the selected DOM element’s content between opening and closing tags or right click on the element and select Edit as HTML command in popup menu brings us to edit the content.

1 Like
  1. What is the console used for?
    Experimenting and modifying Javascript within a particular webpage
  2. How do you open the Console in Google Chrome?
    CNTL, SHIFT, J opens the console in Chrome
  3. What does console.log function do?
    prints the outputs(strings, returns of functions)
  4. How can you change the contents of an HTML page through the console?
    by adding script into an element to change the way it appears/interacts
1 Like
  1. Writing, managing and monitoring JavaScript on demand.
  2. Menu at the top-right of your browser window signified by three vertical dots in a row. From there, you can select More Tools and then Developer Tools. This will open a panel where you can click on Console along the top menu bar to bring up the JavaScript Console
  3. Instead of making it pop up in the browser all the time, it’s printing string in the console as a result, makes it easier to work on and also can change any command that you passed through
  4. You need to create file in the text editor first, using specific syntax you then save file and open it in a browser and now you can open a console and add or edit any info through Console
1 Like
  1. The Console is a tool which can be used to log information. It essentially allows you to interact with a web page by providing you the ability to write, manage and monitor JavaScript on demand.

  2. Menu > More Tools > Developer tools > Console
    Or alternatively Control + Shift + J

  3. The console.log function allows you to update or test Javascript from the console.

  4. On a HTML page if you want to change the contents you can right click then click ‘inspect’, this will open up the panel where you can access the console. From there you can enter Javascript to modify the contents such as inserting a heading or changing the colour of text or background etc.

1 Like
  1. What is the console used for?
    Console is used to write, manage, and monitor JavaScript on demand.
  2. How do you open the Console in Google Chrome?
    CTRL + SHIFT + J on Linux or Windows, or COMMAND + OPTION + J on macOS,
  3. What does console.log function do?
    It outputs info in non alert form.
  4. How can you change the contents of an HTML page through the console?
    By editing the DOM
1 Like
  1. The console is used as an interface within the browser to write, manage, and and monitor JavaScript.

  2. Go to the 3 horizontal dots in the top right, click more tools, then developer tools. From there, click “console” on the top bar. You can also hit Command+Option+J in MacOS.

  3. The console.log function allows you to execute code within the console without having to close an alert box.

  4. You can open the console and start using JavaScript to add text, change colors etc.

1 Like
  1. What is the console used for?
    The Console can be used to log information as part of the JavaScript development process, as well as allow you to interact with a web page by carrying out JavaScript expressions within the page’s context. Essentially, the Console provides you with the ability to write, manage, and monitor JavaScript on demand.

  2. How do you open the Console in Google Chrome?
    To open the JavaScript Console in Chrome, you can navigate to the menu at the top-right of your browser window signified by three vertical dots in a row. From there, you can select More Tools then Developer Tools.

  3. What does console.log function do?
    The JavaScript console provides us a space to try out the JavaScript code in real time.

Whithin the console we can type the JavaScript code for example to print alerts on the screen
Example:

To perform math, date …etc
4. How can you change the contents of an HTML page through the console?

We change the HTML page in console by using the JavaScript code

1 Like
  1. it is used for a “live coding”. Is not a definite change but you can see what you are actually building.

  2. right click, INSPECT and choose CONSOLE from the menu.

  3. it allows to see the result of your code directly on the console, avoiding popping up messages.

  4. right click, INSPECT, ELEMENTS

1 Like
  • What is the console used for?
    The Console provides you with the ability to write, manage, and monitor JavaScript on demand.

  • How do you open the Console in Google Chrome?
    To open the JavaScript Console in Chrome, you can navigate to the menu at the top-right of your browser window signified by three vertical dots in a row. From there, you can select More Tools then Developer Tools.
    This will open a panel where you can click on Console along the top menu bar to bring up the JavaScript Console if it is not highlighted already:

  • What does console.log function do?
    A console.log defines an expression and will actually give you an output.

  • How can you change the contents of an HTML page through the console?
    If you save the HTML file, and load it into the browser of your choice, you should see a blank page with the title of the page as Today's Date .
    You can then open up the Console and begin working with JavaScript to modify the page.

1 Like

What is the console used for?
The console is a tool built in a browser, that can be used to log information, allows to write and manage JavaScript and allows to interact with a web page by carrying out JavaScript expressions withing the page.

How do you open the Console in Google Chrome?
"To open the JavaScript Console in Chrome, you can navigate to the menu at the top-right of your browser window signified by three vertical dots in a row. From there, you can select More Tools then Developer Tools.
You can also enter into the JavaScript Console by using the keyboard shortcut CTRL + SHIFT + J on Linux or Windows, or COMMAND + OPTION + J on macOS, which will bring focus immediately to the Console."
Or just press “F12”!

What does console.log function do?
It prints out in the web console any kind of message/variables as defined before.

How can you change the contents of an HTML page through the console?
You can load the HTML file into the browser, open the Console and use JavaScript to modify the page and experiment with the HTML, however, this does not change the HTML document and once reloaded the page will return to its original state.

1 Like