Skip to content

Extend test cases with passing a named function #56

@timagixe

Description

@timagixe

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],
       ]
     ],
   ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions