JSFiddle - React, Tailwind, and code Playground

JavaScript

str = "Hello World";
find = (function(str,c){
    results = []  
    for(i=0;i<str.length;i++){
       if (str[i].toLowerCase()===c)
           results.push(i)
    }
    return results
});
alert(find(str,'l'))