Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
Why can't I access the attributes of this BackboneJS model?

I'm new to BackboneJS. I'm trying to build a model and view, understanding how they work as I build them.

If I create my model like this:

    const VideoViewerModel = Backbone.Model.extend({
      defaults: {
        video: '',
        title: '',
        description: ''
      }
    })

const videoModel = new VideoViewerModel;

I get get this in my console:

videoModel.attributes
{video: '', title: '', description: ''}

But I I create it like this:

const VideoViewerModel = Backbone.Model.extend({
  defaults: function () {
    return {
      video: '',
      title: '',
      description: ''
    }
  }
})

const videoModel = new VideoViewerModel;

I get this in my console:

videoModel.attributes
{}

Why am I getting two different results?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda