JSFiddle - React, Tailwind, and code Playground
by schawaska
HTML
<input type="text" id="t">
JavaScript
var Pascalize = function(word) {
var x = word;
result = '';
if(-1 != word.indexOf('_')) {
x = word.split('_');
for(var i=0;i<x.length;i++) {
result += x[i].substr(0, 1).toUpperCase() + x[i].substr(1);
}
}
if('' == result) { result = word; }
return result;
};
var textBox = document.getElementById('t');
textBox.value = Pascalize("this_is_a_test");