Solution:
var fileName = fullPath.replace(/^.*[\\\/]/, ''); // This will handle both \ or / in paths.