Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including array-any-index with all npm packages installed. Try it out:

var arrayGet = require('array-any-index'); var arr = [1, 2, 3, 4, 5]; var r1 = arrayGet(arr, -1); // result: 5 var r2 = arrayGet(arr, 0); // result: 1 var r3 = arrayGet(arr, 0.5); // result: 1.5 var r4 = arrayGet(['red', 'blue'], 0.5); // result: '#080080' console.log(r1, r2, r3, r4);

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

array-any-index v0.0.5

get values from an array using any index: negative or float

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free