diff --git a/opal/corelib/array.rb b/opal/corelib/array.rb
index <HASH>..<HASH> 100644
--- a/opal/corelib/array.rb
+++ b/opal/corelib/array.rb
@@ -580,6 +580,7 @@ class Array
     
     %x{
       var i;
+      var length;
       var stack;
       var chosen;
       var lev;
Missed declaring var length; fixed