Javascript Strings

Javascript Strings represents sequence of char. String is associated with string literal , Example :-“ tutorialworldin ”. In java script it is constant and it can not be changed.’-‘ operator is overloaded to concatenate two String operands ‘-‘. Java String class provides a lot of methods  compare(),  concat(), equals(), split(), length(), replace(),  compareTo(), etc.

<html>
<head>
<title>we are using javascript join method in this example</title>
</head>
<body>
<script>
var myarray = [“red”,”green”,”blue”];
var stringversion = myarray.join(“-“);
//alert(stringversion);
document.write(“result without join method = “+myarray+”<br>”);
document.write(“we are using join method in this result = “+stringversion);
</script>
</body>
</html>

Javascript Strings Result :-

result without join method = red,green,blue
we are using join method in this result = red-green-blue

 

Question :- Reverse String Function Example ?

Question :-  Slice function  with string ?

Question  : – to String Function Example ?




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top