WillSquire
6/30/2015 - 3:32 PM

File extension - Retrieves the file extension from a string.

File extension - Retrieves the file extension from a string.

/**
 * Retrieves the file extension from a string.
 *
 * @param {string} filename
 * @returns {string}
 */
function fileExtension(filename) {
  return filename.substr(filename.lastIndexOf('.') + 1);
}