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 8270873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:42:27+00:00 2026-06-08T06:42:27+00:00

I wonder why I couldn’t find any good example of this: Inside the function,

  • 0

I wonder why I couldn’t find any good example of this:
Inside the function, person is an object and there is correct values and selectedPerson is a global variable. Don’t bother \-signs, that was the way to get those visible here.

document.getElementById(heading).innerHTML="<\p><\strong>" + selectedPerson.name+"<strong><\\p>";

This is not working and neither this inside the html:

<p>
     <strong>
        <script>document.write(selectedPerson.name);</script>
     </strong>
</p>

var selectedPerson;
function person(extra){

var extra_array=extra.split(",");

this.name=extra_array[0];
this.head=extra_array[1];
this.gValue=extra_array[2];
this.weight=extra_array[3];
alert(extra_array[0]+" "+extra_array[1]+" "+extra_array[2] +" "+extra_array[3]);
//alert(this.name" "this.head+" "+extra_array[2] +" "+extra_array[3]);

}

selectedPerson = new person(extra);
    console.log("**************************extra-------------->" +extra);

And the question is: How can I use global variable/Object inside the HTML? I would like to know both ways if there is? Alert is working when using array, but not with this.name etc. How can I use syntax selectedPerson.name inside the HTML?

Thank you!
Sami

  • 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-06-08T06:42:28+00:00Added an answer on June 8, 2026 at 6:42 am

    You are instantiating new person() with extra which is undefined.

    This will error as you try to split() it, and undefined doesn’t have a split method.

    So selectedPerson will be undefined as the object will fail to to be created.

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

Sidebar

Related Questions

Couldn't find a better place to ask this so I hope you guys can
I searched for this a lot but couldn't find the answer. Tomcat documentation on
After searching for posts regarding ScrollView not showing I couldn't find one example that
I couldn't find useful info on SSH proxy setting in mechanize, so I wonder
wonder if someone could help me with a little problem. I have session values
I wonder if someone could be kind enough to explain the function.prototype thingie (thingie!!??)
I'm surprised this question wasn't asked before on SO (well, at least I couldn't
The title of this question is a bit misleading, but I couldn't summarize this
I wonder whether I can manage fragments like Activity. I implemented tab function with
I wonder if there is an easy way to see the SQL generated by

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.