JSFiddle - React, Tailwind, and code Playground

by Alexander

JavaScript

console.clear();



var s = 'PHP Developer (Middle/Senior)';


function t(val) {
	return val
    .toLowerCase()
  	.replace(/\\/g, '/')
    .trim()
    .replace(/^\w+/, function(s){
        return (s.length < 4)
          ? s.toUpperCase()
          : s[0].toUpperCase() + s[0].slice(1)
    })
}


console.log( t(s) )