From 72504aaf0e6d2c35931c50ed84cd50a401a9f6bf Mon Sep 17 00:00:00 2001 From: lee allen Date: Thu, 28 Jan 2016 19:34:36 -0500 Subject: [PATCH] Adding a native array method to rest-params.js --- rest-params.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rest-params.js b/rest-params.js index 7dcfa5a..0cc76d4 100644 --- a/rest-params.js +++ b/rest-params.js @@ -7,4 +7,11 @@ function foo(...x){ return x.length; } -foo(1, 2, 3, 4); // 4 \ No newline at end of file +foo(1, 2, 3, 4); // 4 + +function bar(...y) { + // y has all native array methods + return y.pop(); +} + +bar(1, 2, 3); // 3