diff --git a/ext/js/lib/js/array.rb b/ext/js/lib/js/array.rb index 9c82405e9c..214bb3cd09 100644 --- a/ext/js/lib/js/array.rb +++ b/ext/js/lib/js/array.rb @@ -2,10 +2,8 @@ class Array # Convert Ruby array to JavaScript array def to_js new_array = JS.eval("return []") - self.each do |element| - # NOTE: This method call implicitly convert element to JS object by to_js - new_array.push element - end + # NOTE: This method call implicitly convert element to JS object by to_js + new_array.push *self new_array end end