JavaScript Function to Find the Longest Common Prefix
Posted on July 20, 2015 in Algorithms, JavaScript by Matt Jennings
In a JavaScript array, find the longest common prefix of all array elements.
function longestCommonPrefix(arr){
// sort() method …