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

  • Home
  • SEARCH
  • 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 8342661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:50:15+00:00 2026-06-09T05:50:15+00:00

I have stumbled upon this code var Actors = { init: function(config){ this.config =

  • 0

I have stumbled upon this code

var Actors = {

    init: function(config){
        this.config = config;
        this.bindEvents();
    },

    bindEvents: function(){
        this.config.letterSelection.on('change',this.fetchActors );
    },

    fetchActors: function(){
        console.log('fetching');
    }
};

And at first I was thinking what kind of Javascript is this. I don’t know what to search for. so I guess asking it here is approrpriate

What I understand is that var Actors is an object.
but what about these?

 init: function(config){
        this.config = config;
        this.bindEvents();
    },

What do you specifically call the literal “init” ? is it called an object literal? after the init it has a function attached to it what do you call it?

I understand what the code is doing. but I don’t know what to call them in technical terms.
so what type of javascript is this? why does a word “init” has a function to it

  • 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-09T05:50:16+00:00Added an answer on June 9, 2026 at 5:50 am

    JavaScript is kinda functional language, which means that functions are first-class objects in it. So if you have a variable, then you can assign to it some string, some number, some object or some function, like this:

    var a;
    a = function() {};
    a(); // Call this function
    

    In the same way you can assign a function to an object property, like this:

    var a = {};
    a.myProp = function() {};
    a.myProp(); // Call this function
    

    But when you call your function like a.myProp(), then this function also receives a special argument called this which points to a.

    So, in your case Actors is assigned object literal, which has a property init, which is assigned a function. You can call it method, but this is a concept from other OO languages. Here, it’s just a property which is assigned a function.

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

Sidebar

Related Questions

I refactored my JS code recently and stumbled upon this pattern: APP = (function()
Have stumbled upon this code to insert the contents of a file into a
I'm pretty new in iphone programming and have stumbled upon this issue which I
In the Getting things gnome code base I stumbled upon this import statement from
I have been going over rails scheduling tasks options and stumbled upon this piece
I stumbled upon a function called v8Locale in Chrome's Developer Console. I was curious
I'm revisiting som old code of mine and have stumbled upon a method for
I stumbled upon this piece of code today: CGRect rect = {{0,0},{w,h}}; Here, I
I stumbled upon this piece of code which seems totaly broken to me, but
I just stumbled upon a change that seems to have counterintuitive performance ramifications. 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.