0

When I type clear in console, it gives me g id=clear and then a path. What does it mean?

I am not able to understand the value, so looking for some help :)

Screenshot of developer tool

1

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • Does this answer your question? [Is there a spec that the id of elements should be made global variable?](https://stackoverflow.com/questions/6381425/is-there-a-spec-that-the-id-of-elements-should-be-made-global-variable) – Ivar Dec 19 '22 at 13:38
  • There is an element with the `id="clear"` within the document, making it a global variable. That is what you are printing there. – Ivar Dec 19 '22 at 13:39
  • Also: [Do DOM tree elements with IDs become global properties?](https://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-properties) – Ivar Dec 19 '22 at 13:40
  • I could not find anything similar. – Avirup Dutta Gupta Dec 19 '22 at 13:41
  • @Ivar could you please tell from where this id is coming and what does the path specify? – Avirup Dutta Gupta Dec 19 '22 at 13:43
  • This tag is somewhere in the HTML of that page. You'll need to ask the developers how it got there. [`` is just an HTML element](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path). – Ivar Dec 19 '22 at 13:47
  • I dont think it is coming from any HTML. You can simply start an Incognito window and just type clear in console. – Avirup Dutta Gupta Dec 19 '22 at 14:08
  • The default page that is shown when you open a new tab still has HTML. Right click on the `...` and then click on "Reveal in Elements panel" to show the rest of the HTML. – Ivar Dec 19 '22 at 14:11

1 Answers1

0

To clear the console, you can execute clear() (notice the parenthesis after), or even console.clear().

Basically, as noticed above, you are likely accessing a global element from the DOM. In this case, you should be calling the clear() function or console.clear() function, rather than just entering the variable.