Unless of I use <script> in my HTML, can Inspect element show my javascript code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Unless of I use <script> in my HTML, can Inspect element show my javascript code?

8th Jul 2019, 3:59 AM
Cheese Burger Joe
Cheese Burger Joe - avatar
3 Answers
+ 3
Cheese Burger Joe maybe it wouldn't show the content of the script in the inspector tool if the src attribute was used to load a script from a file. However you can always click on the src attribute to show the JavaScript file in a new tab and the debugger also lists all scripts that were loaded on a page. It's impossible to hide JavaScript code, but you can minify it or use other methods to make it harder to read.
9th Jul 2019, 7:21 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
There is no other way than a script tag to run JavaScript in HTML, so you can inspect any script you want in your browsers dev tools. Btw. there's also a console and a debugger section in the dev tools usually that help you a lot to debug your code.
8th Jul 2019, 6:50 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Aaron Eberhardt I know that you cant put javascript in HTML without <script>, but I mean if you had a seperate index.js file. Would that still show?
9th Jul 2019, 1:04 AM
Cheese Burger Joe
Cheese Burger Joe - avatar