Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-10-2011, 11:58 AM   PM User | #1
jamesab1156
New Coder

 
Join Date: Apr 2011
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
jamesab1156 is an unknown quantity at this point
Question Insert a character into a string

Suppose I have the string 'ello'.
I want to insert the letter 'h' in the beginning of that string.

How do I do that without using a special function? I can only use the functions charAt and indexOf - anyone has any idea?

Last edited by jamesab1156; 04-10-2011 at 12:08 PM..
jamesab1156 is offline   Reply With Quote
Old 04-10-2011, 12:02 PM   PM User | #2
jamesab1156
New Coder

 
Join Date: Apr 2011
Posts: 18
Thanks: 3
Thanked 0 Times in 0 Posts
jamesab1156 is an unknown quantity at this point
Quote:
Originally Posted by jamesab1156 View Post
Suppose I have the string 'ello'.
I want to insert the letter 'h' in the beginning of that string.

How do I do that without using a special function? I can only use the functions charAt and indexOf - anyone has any idea?
I got it

Just use the + sign, stupid me... lol...

newString = 'h' + 'ello';

And that's it ...
jamesab1156 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:29 AM.


Advertisement
Log in to turn off these ads.