Home arrow JavaScript arrow Page 3 - JavaScript Objects: More on String Methods
JAVASCRIPT

JavaScript Objects: More on String Methods


Welcome back to my series covering JavaScript Objects. In the last issue we discussed the Object String properties and some of the Object String methods. In this episode we will continue our discussion of the Object String methods and how to use them.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
January 22, 2008
TABLE OF CONTENTS:
  1. · JavaScript Objects: More on String Methods
  2. · The CharAt() Method
  3. · Working with the ConCat() Method
  4. · The FontColor() Method
  5. · FromCharCode() Method
  6. · The LastIndexOf() Method

print this article
SEARCH DEVARTICLES

JavaScript Objects: More on String Methods - Working with the ConCat() Method
(Page 3 of 6 )

The ConCat() method allows you to join two or more strings together. Say you have a program with a first name, last name, and a title. You might want to join the two names together. This is how you can do so:


<html>

<body>


<script type="text/javascript">


var firstname="Leroy "

var secondname="Brown"

var title="Baddest Man in the Whole Damn Town"

var linebreak=("<br />")

document.write(firstname.concat(secondname))

document.write(linebreak)

document.write(title)

</script>


</body>

</html>

 

This would result in the following being displayed to the browser:

  Leroy Brown
  Baddest Man in the Whole Damn Town

Fixing It With the Fixed() Method

The Fixed() method allows you to create Teletype text, like so:


<html>

<body>


<script type="text/javascript">


var news="James Payne wins his third Nobel Prize for Literature!"


document.write("<p>This just in: " + news.fixed() + "</p>")

</script>


</body>

</html>

This would result in the following:

  This just in: James Payne wins his third Nobel Prize for Literature!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials