Good evening Friends! When I try to run the below mentioned function in chrome console, output comes out but minus sign is unreplaced.
function kebabToSnake(kebab){
var i=0;
for(i=0;i<kebab.length;i++){
if(kebab[i]=='-'){
kebab[i]='_';
}
}
var newStr=kebab;
return newStr;
}
console.log(kebabToSnake("a-b-c-d"));
Even if i try to return kebab without creating newStr , still does not work . I already know the replace method in javascript . Just want to know why this method does not work out !