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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:04:17+00:00 2026-06-07T05:04:17+00:00

What is the name of the technique the example uses below to pass a

  • 0

What is the name of the technique the example uses below to pass a variable to an object in javascript? And furthermore, why is it not working (“large” is not outputted to the console log as expected)?

var thumbnailBlock = new ThumbnailBlock();
thumbnailBlock.thumbnailSize = "large";


function ThumbnailBlock() {

    this.thumbnailSize;

    console.log("DEBUG");
    console.log(this.thumbnailSize);
}
  • 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-07T05:04:19+00:00Added an answer on June 7, 2026 at 5:04 am

    The explanation what is going wrong in your code from Willem Mulder’s answer:

    There is no specific name. You simply set an object property.

    The ‘large’ is not outputted because you first create an object using the ThumbnailBlock constructur function (where it logs the this.thumbnailSize) and only then set the .thumbnailSize to "large".

    You could pass the size as function argument.

    function ThumbnailBlock(size) {
        this.thumbnailSize = size;
    }
    
    var thumbnailBlock = new ThumbnailBlock("large");
    
    console.log(thumbnailBlock.thumbnailSize);
    

    Also, have a look at the The Constructor Pattern and other nice patterns on that page. I also recommend the chapter on OOP in the free book Eloquent JavaScript.

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

Sidebar

Related Questions

string name = bob; object obj = name; obj = joe; Console.WriteLine(name); I'm a
Im trying to pass the name of a global variable to a sub routine
I was wondering if this technique has a name - changing state methods to
Example routine: const Armature* SceneFile::findArmature(const Str& name){ for (int i = 0; i <
I just started experimenting with a new technique I name (for the moment at
Example: <img src=/images/name.jpg alt= /> This is what I want: <img src=name.jpg alt= />
I'm looking for the name of the pattern or technique whereby one can dynamically
In my example i want to get promotion elements for a promo code name
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
name_iexact keyword is a parameter we can pass to filter function in django.model. Can

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.