Git Product home page Git Product logo

js-developer-exercises's Introduction

Vidpresso Take Home Developer Exercise

Instructions

There are 5 functions in this exercise:

  • createObject
  • findChildren
  • getElement
  • readFile
  • say

For each function, there are associated tests that are all currently failing. To complete this exercise, make all the tests pass.

To run the tests: $ npm test

You are free to implement each function as you see fit, but none of the specs themselves are allowed to change. The specs could be a good place to get some hints for how to do your implementation. All the specs are in spec folder.

How each function should work

createObject

This function should take one string as an argument that returns an object with a getMessage function. When getMessage is called, it should simply return the string that was supplied to createObject. The function getMessage should be defined on the object's prototype, not the object itself.

findChildren

This function takes two arguments. The first argument is a string id and the second argument is a tree object. Each node in the tree has an id and children property. children is an array of nodes that each have their on id and children property.

This function should find the node with the supplied id and return its children. If no node is found, it should return null.

getElement

This function takes a document and a valid CSS selector string as an argument. It should return the first element from the document that matches the selector. If no element is found, should return null.

readFile

This function should open a file and read its contents as JSON. The argument to this function is the path of the file to be opened. If file doesn't exist, it should reject the promise.

say

This function takes a single string as an argument. It's return value should allow you to supply another string that can be added to the first string.

js-developer-exercises's People

Contributors

davidturissini avatar isaadabbasi avatar

Watchers

James Cloos avatar  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.