Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myFunc() {
- return Array.prototype.slice.call(arguments);
- // args is now a real Array, so can use the sort() method from Array
- }
- console.log(myFunc('USA', 'UK', 'India'));
- console.log(myFunc('USA', 'UK', 'India').sort());
- // Will output =>
- // [ 'USA', 'UK', 'India' ]
- // [ 'India', 'UK', 'USA' ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement