Tutorial covering all the methods in Javascipt using strings

Tutorial covering all the methods in Javascipt using strings


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Test Page</title>
</head>


<body>

/* THIS EXAMPLE BASICALLY COVERS ALL THE IMPORTANT METHODS FOR STRINGS IN AN ARRAY  */

  <script type="text/javascript">

    var typo = " WELCOME TO THE CRUEL WORLD ";
    var typo1 = "SOONER OR LATER YOU WILL DIE";

    <!-- var typo = "Lorem ipsum dolor sit amet, sit consectetur adipisicing."; -->
    <!-- var b = typo.length; -->
    <!-- var b = typo.toLowerCase(); -->
    <!-- var b = typo.toUpperCase(); -->
    <!-- var b = typo.includes("sit"); -->
    <!-- var b = typo.includes("SIT"); -->
    <!-- var b = typo.startsWith("Lorem"); -->
    <!-- var b = typo.endsWith("amet."); -->
    <!-- var b = typo.search("amet."); -->
    <!-- var b = typo.match("sit"); -->
    <!-- var b = typo.lastIndexOf("sit"); -->
    <!-- var c = typo.indexOf("sit"); -->
    <!-- var c = typo.replace("sit" , "hello");
    <!-- var c = typo.trim(); -->
    <!-- var c = typo.charAt(5); -->
    <!-- var c = typo.charCodeAt(5); -->
    <!-- var c = String.fromCharCode(65) -->
    <!-- var c = typo.concat(typo1); -->
    <!-- var c = typo.split(" "); -->
    <!-- var c = typo.repeat(2); -->
    <!-- var c = typo.slice(5,12); -->

    var c = typo.substr(5,12);
    var d = typo.substring(5,12);


    console.log(c);
    console.log(d);

  </script>
</body>
</html>



Comments

Popular posts from this blog