Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6537283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:35:54+00:00 2026-05-25T10:35:54+00:00

I tried use javascript spilt to get part of the word : new from

  • 0

I tried use javascript spilt to get part of the word : new from What#a_new%20day

I tried code like this:

<script>
var word="What#a_new%20day";
var newword = word.split("%20", 1).split("_", 2);
alert(newword);
</script>

But caused:

Uncaught TypeError: Object What#a_new has no method 'split'

Maybe there have more wiser way to get the word which I need. So can anyone help me? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:35:55+00:00Added an answer on May 25, 2026 at 10:35 am

    split returns an array, so the second split is trying to operate on the array returned by the first, rather than a string, which causes a TypeError. You’ll also want to add the correct index after the second call to split, or newword will also be an array, not the String you’re expecting. Change it to:

    var newword = word.split("%20", 1)[0].split("_", 2)[1];
    

    This splits word, then splits the string at index 0 of the resulting array, and assigns the value of the string at index 1 of the new array to newword.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use this: private void CreateDevice() { _playbackDevice = new WaveOut(); _playbackDevice.PlaybackStopped
I tried to use this code but it doesn't work. http://developer.apple.com/library/ios/#samplecode/PageControl/Introduction/Intro.html Ld /Users/waitonza/Library/Developer/Xcode/DerivedData/Dr_Ngoo-aanknxmuodcgjicaigxevljxokeq/Build/Products/Debug-iphonesimulator/Dr Ngoo.app/Dr
I'd like to use Vows to test DOM-free JavaScript code, ideally directly running against
I want to use this javascript but being able to hard code 3 users,
I have html code like this <telerik:RadButton ID=rdYes runat=server AutoPostBack=False ButtonType=ToggleButton CssClass=rdYes Text= ToggleType=Radio
I want to add text dynamically on an image. I tried to use javascript
I'm looking for code that allows me to use JavaScript to load another JavaScript
I'm trying to use javascript as little as possible on this project. I would
Is it possible to use javascript to disable any code that would take the
I would like to use JavaScript to do the following: Build an XML file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.