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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:58:05+00:00 2026-06-15T17:58:05+00:00

im trying to build a javascript matrix as an object. i tied : var

  • 0

im trying to build a javascript matrix as an object.

i tied :

var variations={}; 
variations["p1088"]["red"]["gen"]=1107;
variations["p1090"]["red"]["l"]=1288;

and

var variations={}; 
variations.p1088.red.gen=1107;
variations.p1090.red.gen=1288;

but both throws an exception

TypeError: variations.p1090 is undefined

whats wrong here ?

  • 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-15T17:58:06+00:00Added an answer on June 15, 2026 at 5:58 pm

    because you cannot assume that p1088, red, and gen are objects. This works:

    // short version
    var variations = { p1088: { red: { gen: 1107 } } };
    
    // long version
    var varations = {};
    varations.p1088 = {};
    varations.p1088.red = {};
    varations.p1088.red.gen = 1077;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm somewhat new to object oriented programming in Javascript and I'm trying to build
I'm trying to understand how to build a JSON object in JavaScript. This JSON
I am trying to build a 3D Javascript array, but I am unsure of
I'm trying to build modal windows on the fly from single javascript object passed
This is partially a javascript technique question. I am trying to build an object
I am trying to build a simple calculator to learn javascript/jquery but seem to
I'm trying to build an object in javascript using self-invoking functions to set the
I am trying to build a javascript object to submit a form. One property
I'm trying to build something on javascript that I can have an input that
I am trying to build a little javascript class for geocoding addresses trough Google

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.