Is there an alternative to console.log() which lets you print out and update a single line instead of spamming the console?

I am looking for a way to print out a given variable f.ex. the i of a for-loop for each iteration, without it resulting in the entire console being filled with new lines of new values. Is there a console. method for just printing one line, and updating that as we go?

I realise that you could do this by implementing a text-field in your program which you change the with each iteration, but if there is a way of doing this in the console it would be a bit easier (and perhaps quicker? although I am really not sure about that). Thanks in advance.

If there is still confusion about what im asking, what i want is my console to print out: “i = ” i once, and then update the i in that one line, instead of:

i=1 i=2 i=3 1=4 . . . 

which gets really messy as you go. For the exact example of the i in a for loop, you could get this value from just console.log()’ing the same thing for each iteration, and a number will pop up beside it (in firefox anyway), but i would like to be able to do this with some more useful information.

“const” variable not defined when used with “console.log”

I’m currently playing around with “const” variable in javascript and here is my code

enter image description here

My question is, why is “const x” undefined when used with “console.log”, but it is defined when used on its own?

p.s. — I understand that both global “const, let” do not become the property of “window” object, unlike global “var”. But I am unsure as to whether this played any role in the code above.