Code Testing using Java Script

Hi
I have a general question about back end testing for the website,
instead of writing script separately, why can’t one go directly into the HTML or JS text and make correction on the original files.

thanks…

Are you using nodeJS? On hand you mention Javascript (plain javascript is front-end), yet you also mention back-end

what script? Without these information, its unclear what changes/correction you want to make, and why (or why not) this is possible

i am exclusively referring to:
chapter 14 within Web Development course where code testing is done using JSNode

…if we have HTML file and back -end file using JS then if there are
any errors then why not to alter these files directly rather writing another code using JSNode

I found the right chapter:

https://www.codecademy.com/paths/web-development/tracks/test-driven-development-javascript/modules/why-test/lessons/why-test/exercises/automated-testing

not sure if its the right lesson

Can you give an example of this?

my question is of fundamental nature…
why to use a separate files to test and correct the website when one can change the main files and gauge the performance against client set criteria…
thanks…

How do you propose we write tests then?

By putting the tests in a separate file, the tests don’t have to be loaded by client, but are only used when running test. (And they take up small amount of storage, but the pros outweigh the cons)

The automated test make it much easier to detect bugs, which saves a lot of time and effort in the long run

many thanks…i will read into it a bit more and discuss perhaps later…