Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active February 2, 2016 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/64d2878cb86324b6b49c to your computer and use it in GitHub Desktop.
Save conanak99/64d2878cb86324b6b49c to your computer and use it in GitHub Desktop.
function log(level, time, message) {
console.log(level + ' - ' + time + ': ' + message);
}
// Không có this nên set this là null
// Set mặc định 2 tham số level và time
var logErrToday = log.bind(null, 'Error', 'Today');
// Hàm này tương ứng với log('Error', 'Today', 'Server die.')
logErrToday("Server die.");
// Error - Today: Server die.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment