substr() in strings using JS

substr() in strings using JS


<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
<script type="text/javascript">

/*substr is basically used to slice the string from one position to another
in the given string, but it will count the number of characters as passed in the 2nd parameter from the 1st parameter and will return the code till there unlike slice which only looks at the position of the parameter passed*/

var str= "THIS IS AN ARTISITIC STYLE OF REPRESENTING THINGS";
var newie = str.substr(5,5);
console.log(newie);



</script>

</head>
<body>
<h1></h1>
</body>
</html>




Comments

Popular posts from this blog