Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend test cases with passing a named function #56

Open
timagixe opened this issue Jan 22, 2023 · 0 comments · May be fixed by #57
Open

Extend test cases with passing a named function #56

timagixe opened this issue Jan 22, 2023 · 0 comments · May be fixed by #57

Comments

@timagixe
Copy link

timagixe commented Jan 22, 2023

According to MDN (source):

If function name is omitted, it will be the variable name (implicit name).
If function name is present, it will be the function name (explicit name).

Code exmaple:

const foo = function () {};
foo.name // "foo"

const foo2 = foo;
foo2.name // "foo"

const bar = function baz() {};
bar.name // "baz"

I suggest extending test cases with the following case:

diff --git a/Exercises/4-methods.test b/Exercises/4-methods.test
index a408b22..78eb07d 100644
--- a/Exercises/4-methods.test
+++ b/Exercises/4-methods.test
@@ -10,11 +10,15 @@
         },
         m3(x, y, z) {
           return [x, y, z];
-        }
+        },
+        m4: function sum(x, y) {
+          return x + y;
+        },
       }, [
         ['m1', 1],
         ['m2', 2],
-        ['m3', 3]
+        ['m3', 3],
+        ['sum', 2],
       ]
     ],
   ]
@timagixe timagixe linked a pull request Jan 22, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant