Giter Club home page Giter Club logo

dm2-hackathon-toy-problem's Introduction

splitAny

This hackathon's challenge is to write a function splitAny that can take in an array, string, number, object, or function and split it into an array based on the following structure:

splitAny( [ 10, { test: `test` }, () => `hello` ] ); // Returns the split value of each item in the array [ [ 1, 0 ], [ [ `test`, `test` ] ], [ `h`, `e`, `l`, `l`, `o` ] ];

splitAny( `Hello` ); // Returns [ `H`, `e`, `l`, `l`, `o` ];

splitAny( `Hello world` ); // Returns [ [ `H`, `e`, `l`, `l`, `o` ], [ `w`, `o`, `r`, `l`, `d` ] ];

splitAny( 204672 ); // Returns [ 2, 0, 4, 6, 7, 2 ];

splitAny({ test: 1, anotherThing: `hello` }); // returns [ [ `test`, 1 ], [ `anotherThing`, `hello` ] ];

splitAny( () => `MyString` ); // Returns the split value of the function's return value [ `M`, `y`, `S`, `t`, `r`, `i`, `n`, `g` ];

splitAny( false ); // Throws this TypeError specifying the type of the input and the input `Expected an array, string, object, number, or function, instead got boolean false`

splitAny( undefined ); // `Expected an array, string, object, number, or function, instead got undefined undefined`

The function should not modify the original argument in any way.

Grading based on:

  • Completion
  • Clever solutions
  • ES6 usage

To participate fork this repo and clone your fork, commit and push once you have a solution so we have a timestamp of when it was completed.

Unit tests have been provided, to run them:

  • npm install
  • http-server/live-server/whatever-server

Good luck!

dm2-hackathon-toy-problem's People

Contributors

r-walsh avatar

Watchers

James Cloos avatar Zachary McKimmins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.