14-longest-common-prefix

DevGod needs to write a blog entry for this problem!
var longestCommonPrefix = function (strs) {
    if (strs.length === 0) return "";

    let prefix = strs[0];

    for (let I = 1; I < strs.length; I++) {
        while (strs[I].indexOf(prefix) !== 0) {
            prefix = prefix.slice(0, prefix.length - 1);
            if (prefix === "") return "";
        }
    }

    return prefix;
};