How to get function arguments as array in JavaScript

Functions
By Jad Joubran · 
Last updated Dec 19, 2017
function log(...msgs) {
  //msgs is now an array
  console.log(`Received ${msgs.length} messages`);
}

log("code", "to", "go");
log("code", "to", "go", "is", "cool");
Received 3 messages
Received 5 messages