1
var commonChars = function (words) {2
//record the first word characters in an array called minFreq3
//iterater over the rest of the input array4
//record the characters for each word called freq5
//update the corresponding minFreq element to the smaller one between each word and the first word6
//after collect all the words' freq and update the minFreq, iterate over the minReq7
//push the element to the result9
minFreq = new Array(26).fill(0);10
let firstWord = words[0];11
for (let i = 0; i < firstWord.length; i++) {12
let index = firstWord.charCodeAt(i) - 97;15
for (let word of words) {16
let freq = new Array(26).fill(0);17
for (let i = 0; i < word.length; i++) {18
let index = word.charCodeAt(i) - 97;21
for (let i = 0; i < 26; i++) {22
minFreq[i] = Math.min(minFreq[i], freq[i]);25
for (let i = 0; i < 26; i++) {26
for (let q = 0; q < minFreq[i]; q++) {27
let letter = String.fromCharCode(i + 97);