Skip to content

Fix getArrayElementCount method #768

Description

@jsjain

There is currently a method called getArrayElementCount that lives in /lib/getArrayElementCount.js.
It is incomplete and needs to be fixed!

First argument should be array and second arg can be a number or an array.
If first arg is number it returns the number of occurrences of that number.
If second arg is array it returns the combined sum of number of occurrences of elements in array.

For eg: in arrray = [1,2,3,4,5] if [1,2] is given as second arg it should return 2 as 1 occurs once and so does 2 therefore total of 2.

Acceptance Criteria:

  1. Running yarn test <methodName> results in tests passing.
  2. You have written a skeleton method for someone else to work on.
  3. You have written tests surrounding your skeleton method.
  4. Running yarn lint does not print any errors to the console!
  5. Optional: write one or two more tests surrounding the method you are solving to account for potential edge cases.

Please include the skeleton of a new method + an accompanying test for someone else to work on at the time of creating a pull request! A pull request will most likely be denied if it does not contain a skeleton method for someone else to work on! For more information, please read the Contributing Guide.

Thank you so much for your contribution!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions