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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:44:17+00:00 2026-05-20T18:44:17+00:00

<html> <body> <script type=text/javascript> function createPerson (name){ var o = new Object(); o.name =

  • 0
<html>
<body>

<script type="text/javascript">

function createPerson (name){
var o = new Object();
o.name = name;

return o;
};
var person1 = createPerson ("Nicholas");
alert(person1.name);
</script>

</body>
</html>

Why do we have to

return o

?
What does “return” mean?

  • 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-20T18:44:18+00:00Added an answer on May 20, 2026 at 6:44 pm

    return is a JavaScript keyword that causes the function it’s placed in to exit with the specified value (called the “return value”).

    In this case, it causes the createPerson() function to come to an end, returning the o object to the caller of the function.

    The o object, once returned from createPerson(), then gets assigned to the person1 variable.

    So the net result is that control flow starts here

    var person1 = createPerson ("Nicholas");
    

    then jumps into the createPerson() function, which creates a new object representing a person with the name “Nicholas”, then returns it, which brings the execution back to that line, with person1 getting the newly created person that the function returned.

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

Sidebar

Related Questions

<html> <body> <script type=text/javascript> var str=Welcome to Microsoft! ; var val=Microsoft!; document.write(str.replace('/'+val'+/gi', W3Schools)); </script>
<html> <head> <script type=text/javascript src=jQuery.js> <script type=text/javascript> x=document.getElementByTagName(p); document.write(x.lastChild.nodeValue); </script> </head> <body> <p id=intro>Hello
Can someone show me whats wrong with this: <html> <script type = text/javascript> function
I made this Greasemonkey script: var maxpi = 250; var p1 = /html/body/div/div[2]/div/div[2]/table[2]/tbody/tr[1]/td[11]; var
$(#toggle).click(function(){ $(html).toggleClass(bg); }); html.bg { background: blue; } body { background: yellow; } <script
<html> <head></head> <body> <span class=mtb-price> <label Class=mtb-ofr><b class=lb1></b>AAAAA</label></span> <script> var sku = document.getElementsByClassName(mtb-ofr).childNodes[1].nodeValue; alert(sku);
<html> <head></head> <body> <div class=abcd></div> <script> var y = document.getElementsByClassName('abcd'); var x = document.querySelectorAll(abcd);
I mean I have this code: <script> $(document).ready( function() { $('html, body').animate({ scrollTop: $(.error).offset().top
<!doctype html> <html> <body> <div id = 'div' style = 'width:100px;height:100px;background:#000000;'></div> <script type =
$('a').click(function(event){ $('body').html('loading...'); $.post('www.sitename.com/hello',{site:http//:www.google.com},function(data) { alert(data); }); event.preventDefault(); }); I am using the above script

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.