We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e85b08 commit 5103524Copy full SHA for 5103524
Get_Function_Code.js
@@ -0,0 +1,18 @@
1
+
2
+function getFunctionCode(functionName) {
3
+ return typeof functionName === "function" ? functionName.toString() : "The argument is not a function.";
4
+}
5
6
+// Example
7
+function Add(a, b) {
8
+ return a + b;
9
10
+function Subtract(x, y) {
11
+ return x - y;
12
13
14
+// Using custom function
15
+console.log(getFunctionCode(Add));
16
17
+// Using built-in function
18
+console.log(Subtract.toString());
0 commit comments