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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:23:10+00:00 2026-05-28T01:23:10+00:00

In Knockout.js I create an observableArray to push models into: function Room(data) { this.name

  • 0

In Knockout.js I create an observableArray to push models into:

function Room(data) {
        this.name = ko.observable(data.name);

    }   


    function RoomViewModel() {      
        var self = this;
        self.rooms = ko.observableArray([]);
        self.newRoomText = ko.observable();         

        self.addRoom = function() {
            self.rooms.push(new Room({ name: this.newRoomText() }));
            self.newRoomText("");       
            $("#modal").dialog("close");        
        }.bind(self);           
    }

In Backbone.js I would create a collection to store my models:

var Book = Backbone.Model.extend();

var Books = new Backbone.Collection([
  {name: "Abe Lincoln - Vampire Hunter"}
  {name: "Pride and Prejudice and Zombies"}
]);

Just how different are these 2 structures from each other?

What exactly is going on behind the scenes to make these data structures different from a standard Javascript Array?

  • 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-28T01:23:11+00:00Added an answer on May 28, 2026 at 1:23 am

    This is a difficult question to fully answer but here is my take on it :).

    Backbone.js Collection:

    • fetching models from the server
    • triggering change/add/remove events
    • listening to model events and triggering them on collections
    • automatic validation of the models
    • lot of cross-browser convience methods for working with collections (each, max, sort, reduce, etc.)

    Knockout.js observableArray:

    • tracks added and removed elements – updates UI automatically
    • cross-browser implementation of the array’s methods (e.g. IE8 has problems w/ native .indexOf())
    • convience destroy & destroyAll methods for Rails developer that will set _destroy property on objects to true – this will inform Rail’s ActiveRecord which objects should be deleted.

    Backbone.Collection is working with the Backbone.js framework and observableArray only with Knockout.js. There is no real in comparing them with each other in a isolation because they are part of a framework and if your application is built on Backbone you cannot use observableArray and vice versa.

    If you want to know what exactly is going on behind the scenes then here is the source code:

    • Backbone.Collection
    • obervableArray
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have data as follows var data = { facets: [{ name
I am using Knockout javascript library, and I run into this problem: I am
I have the following knockout.js code I’ve got the following: var itemLine = function()
This question relates to selected object pattern with knockout Thanks to the answer, I
I'm trying to build some HTML with Knockout that Jquery UI can turn into
A knockout datepicker data binder can be found here: jQuery UI datepicker change event
I'm new to knockout js and got an observable array, when populating the array
I am designing a viewmodel object in knockout that has an observable array. When
based on the docs for knockout.mapping.js it says that properties of a data object
I'm working with the Google Groups on Knockout's forums for help with this too

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.