dankogai / js-combinatorics

power set, combination, permutation and more in JavaScript
MIT License
742 stars 97 forks source link

Add missing var declaration #1

Closed vzvu3k6k closed 11 years ago

vzvu3k6k commented 11 years ago

After executing Combinatorics.combination(array, num).next(), result leaks into global scope.

var Combinatorics = require('./combinatorics.js').Combinatorics;
console.log(Combinatorics.combination([ 1, 2, 3 ], 2).next()); // [ 1, 2 ]
console.log(result); // [ 1, 2 ]