-
Notifications
You must be signed in to change notification settings - Fork 0
Home
This repository is part of a larger project!
Javascript´s method ToString allows the developer to get the code of a function as a string. Like the following example should show:
function myCode()
{
console.log("Hello World!");
}
myCode.toString();
//Output could look like this without /* and */:
/*
"function myCode()
{
console.log("Hello World!");
}"
*/
It seems there is no defined standard by ECMAScript for the output result of a function as string with the ToString method.
But there are limits of outputing code as string with the ToString method. Here follows one example:
/*
continuation of the first listing (code above)
*/
myCode.bind(null).toString();
//Output could look like this without /* and */:
/*
"function () { [native code] }"
*/
The [native Code] could mean that the method bind has been coded in a different languages then javascript, like C or C++. This refers not only to the bind method, it seems.
STILL IN WORK!
This knowledge was gained:
- Effective JavaScript "68 Specific Ways to Harness the Power of JavaScript" by David Herman
Sources:
-
Location reload() Method by W3Schools
-
Edit and save a file locally with JS asked by Pascal Boutin answered by guest271314