Converts a callback-based function to a promise-based function.
Asked in frontend interviews at Microsoft, Amazon and LinkedIn