Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created February 2, 2016 21:50
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/1b745bfe98c31d0f0d8f to your computer and use it in GitHub Desktop.
Save conanak99/1b745bfe98c31d0f0d8f to your computer and use it in GitHub Desktop.
// Tìm max bằng cách gọi hàm Math.max
Math.max(4, 3, 2, 10);
// Thay vì gọi trực tiếp hàm Math.max, ta có thể dùng call
// Set this bằng null
Math.max.call(null, 4, 3, 2, 10);
// Apply tương tự call, nhưng không truyền lần lượt
// Mà truyền một array chứa toàn bộ các tham số
Math.max.apply(null, [4, 3, 2, 10]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment