Revision - console log function

by andfinally

JavaScript

/*
 Example log function should take any number of arguments
 and prefix them with "(app)"
*/

function log() {
  // arguments is an array-like object - make a shallow copy
  var args = Array.prototype.slice.call(arguments);
  // Prefix them all with "(app)"
  args.unshift('(app)');
  // Call console.log, passing console as the context and the array of arguments
  console.log.apply(console, args);
};