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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:58:25+00:00 2026-05-22T11:58:25+00:00

Please help me to understand below code. This is the script for drag and

  • 0

Please help me to understand below code. This is the script for drag and drop object. I am trying to explore it but struck at one thing.

URL for Reference (Complete Script)

I dont understand how this method creation work, like get x(), set x() etc. Is get and Set is predefined object? will it actually set object value or get specific value of object, like we have in date object.

Also there is one space between its declaration set x(), why?

I am new to java script, i really appreciate your help.

// position strings are "x,y" with no units
get x()
{
    return parseInt(this._position.split(',')[0]);
},

set x(inX)
{
    var comps = this._position.split(',');   
    comps[0] = inX;
    this.position = comps.join(',');
},

get y()
{
    return parseInt(this._position.split(',')[1]);
},

set y(inY)
{
    var comps = this._position.split(',');
    comps[1] = inY;
    this.position = comps.join(',');
},
  • 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-22T11:58:25+00:00Added an answer on May 22, 2026 at 11:58 am

    Let’s start by calling the language ‘JavaScript’ not ‘java script’; the language is standardized as Ecmascript.

    Look up creation of methods in Ecmascript (JavaScript). The functions set(inX) and get() are methods be of some prototype – the clue is the this reference referencing the current instance. However, one should write function get(), and function set(inX) instead.

    From Wikipedia:

    Prototype-based

    prototypes

    JavaScript uses prototypes instead of classes for inheritance. It
    is possible to simulate many class-based features with prototypes in
    JavaScript. functions as object constructors

    Functions double as object constructors along with their typical
    role. Prefixing a function call with new creates a new object and
    calls that function with its local this keyword bound to that object
    for that invocation. The constructor’s prototype property determines
    the object used for the new object’s internal prototype. JavaScript’s
    built-in constructors, such as Array, also have prototypes that can be
    modified. functions as methods

    Unlike many object-oriented languages, there is no distinction
    between a function definition and a method definition. Rather, the
    distinction occurs during function calling; a function can be called
    as a method. When a function is called as a method of an object, the
    function’s local this keyword is bound to that object for that
    invocation.

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

Sidebar

Related Questions

I cannot understand how this is possible. Please help!! I have an app with
I was just testing this download script below. The downloading works fine but the
If there's anyone who can help me understand this one, I will be impressed.
Please help us settle the controversy of Nearly everything is an object ( an
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
Hi Guys could you please help me refactor this so that it is sensibly
Hi Guys can you please help me with this error? What is it? Server
I expected the code below to alert 0 and 1, but it alert 2
Ok I am still having some issues with this code below. I have received
i understand that the code given below will not be compltely understood unless i

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.