Given a string, write the code to find the first occurence of a particular character. If the character is found return the index, otherwise return -1
let str = "Today is Sunday";
let char1 = "i";
let char2 = "z";
function findFirstOccurance(str,char){
// write your code here
}
findFirstOccurance(str,char1);// returns 6
findFirstOccurance(str,char2);// returns -1