Design a program in js so that it can print itself
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
A nice one
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
I suddenly felt that there was nothing to discuss about this question:
To print all the code, add the following code at the end of the program:
Alert (document. getElementsByTagName ("script") [0]. outerHTML)
If the <script> </script>
Alert (document. getElementsByTagName ("script") [0]. innerHTML );
If only the code of a function is printed:
Alert (arguments. callee) // unknown function
Alert (function name) // famous Function
<HTML> <HEAD> <TITLE> New Document </TITLE> </HEAD> <BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]