For this Question: Given an array of N strings, find the longest common prefix among all strings present in the array.The fist line of each test contains a single integer N. Next line has space-separated N strings.

Constraints:-
1 <= N <= 10^3
1 <= |S| <= 10^3
Print the longest common prefix as a string in the given array. If no such prefix exists print "-1"(without quotes).Sample Input:
4
geeksforgeeks geeks geek geezer

Sample Output:
gee

Sampel Input:-
3
a b c

Sample Output:-
-1, I have written this Solution Code:    function commonPrefixUtil(str1,str2)
    {
        let  result = "";
        let n1 = str1.length, n2 = str2.length;
        // Compare str1 and str2
        for (let i = 0, j = 0; i <= n1 - 1 && j <= n2 - 1; i++, j++) {
            if (str1[i] != str2[j]) {
                break;
            }
            result += str1[i];
        }
   
        return (result);
    }

// n is number of individual space seperated strings inside strings variable,
// strings is the string which contains space seperated words.
function longestCommonPrefix(strings,n){
    // write code here
    // do not console,log answer
    // return the answer as string
if(n===1) return strings;
    const arr= strings.split(" ")
    let prefix = arr[0];
         
        for (let i = 1; i <= n - 1; i++) {
            prefix = commonPrefixUtil(prefix, arr[i]);
        }
   if(!prefix) return -1;
        return (prefix);
}, In this Programming Language: JavaScript, Now tell me if this Code is compilable or not?