JSFiddle - React, Tailwind, and code Playground

by darcyclarke

JavaScript

/*******************************************************************

Coding Question One:
-------------------------------

Write a custom animation function that takes 5 parameters:
- An element (type: a DOM Node) 
- A property of that element (type: a string)
- A value for that property to step to (type: a number, potentially a string)
- A duration for the animation in milliseconds (type: a number)
- A callback that executes when the animation is finished (type: a function)

Nice-to-haves:
--------------------------------
- Gracefully handle when you can't animate from one value to another (example: non-numeric values)
- Gracefully handle when you aren't provided the proper number of parameters to your function
- Gracefully handle incorrect types of parameters
- Have fun creating something useful

Example:
--------------------------------
An example of what using this function would look like:

animate( myElement, 'width', 350, 1000, myCallbackFunc );


*******************************************************************/