Skip to content

Instantly share code, notes, and snippets.

@jaywon
Forked from theRemix/2DimensionalArrays.md
Last active August 29, 2015 14:13
Show Gist options
  • Save jaywon/b517b3c009ef411862e9 to your computer and use it in GitHub Desktop.
Save jaywon/b517b3c009ef411862e9 to your computer and use it in GitHub Desktop.

2 Dimensional Arrays

Alternative rules for

[https://gist.github.com/theRemix/bf147e5f06542cdce3d0](MultiDimensional Arrays)

  • create and work on a new branch called two_dimensional

References

Adjust test-generator.js

  • remove specs for generate to accept 0,1,or 3 arguments

Part 4

The Implementation

  • setup MultiDimensionalArray.js as a node module.
  • implement a method named generate so that the tests in test-generator.js pass
    • this method will accept 2 arguments
    • this method will create a new array, and finally return this array
    • the first argument will represent the number of elements the array will contain
    • the second argument represents how many random elements each array in the second tier will contain
      • instead of the first array having n many random boolean values, it will contain n many second tier arrays (which have a random boolean values)
  • commit all your work
  • implement a method named count so that the tests in test-counter.js pass
    • this method will accept 1 or 2 arguments
    • the first parameter accepts an array
    • the optional second parameter represents the value to count in the array
    • this method will return the number of value found in (any depth) of the array
  • commit all your work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment