How to get string length in Vue JS?

Posted by LaravelIndia - 1 month ago

In this small example, i will share with you getting string length in vue js. you can easily get string length in vue.js. we can get vue js get string length using ".length" attribute.

<!DOCTYPE html>
<html>
<head>
    <title>How to get string length in Vue JS? - pakainfo.com</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>

<div id="app">

  <p>String : {{ myString }}</p>
  <p>String Length : {{ myString.length }}</p>

</div>

<script type="text/javascript">

    var app = new Vue({
      el: '#app',
      data: {
        myString: "This is pakainfo.com"
      }
    })

</script>

</body>
</html>