screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <h4>Vue Js Convert String into Title Case using native Javascript Method</h4> <div id="app"> <h1>{{ titleCaseText(title) }}</h1> </div> <script type="module"> const app = Vue.createApp({ data() { return { title: 'hello world!' } }, methods: { titleCaseText(str) { return str.toLowerCase() .split(' ') .map(word => word.charAt(0).toUpperCase() + word.slice(1)) .join(' '); } } }); app.mount('#app'); </script> </body> </html>