Varsnap Demo: Fibonacci Number Calculator

Fibonacci Calculator Code
// Function for calculating fibonacci numbers const calculateFibonacci = varsnap(function calculateFibonacci(index) { if (index <= 0) { return 0; } if (index == 1 || index == 2) { return 1; } return calculateFibonacci(index - 1) + calculateFibonacci(index - 2); });
Varsnap Output

1. Run the fibonacci calculator.
This runs the code in the above IDE and seeds Varsnap with production cases.


 

2. Test the code in this IDE
Run tests on your code above by replaying production test cases against your current code.


3. Log into the demo user account to view debug info
Your Varsnap user account contains recorded Snaps and test results to debug from.

Login to Demo Account