Untitled

Run Settings
LanguageJavaScript
Language Version
Run Command
let arr=['a','b','#','a','b','w'] function findoccurancy(stringArray){ let obj={} for(let ar of stringArray){ if(obj[ar]){ obj[ar]++ }else{ obj[ar]=1 } } console.log('obj',obj) return obj } function findOccuranceBruteForce(stringArray){ for(let i=0;i<stringArray.length;i++){ let count=1 for(let j=i+1;j<stringArray.length;j++){ if(stringArray[i]==stringArray[j]){ count++ } } console.log(`the count for ${stringArray[i]}==${count}`) } } findoccurancy(arr)
Editor Settings
Theme
Key bindings
Full width
Lines