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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:26+00:00 2026-05-28T03:58:26+00:00

I am kind of very new to javascript world. I have a doubt. How

  • 0

I am kind of very new to javascript world. I have a doubt. How do i add/append new values to existing hash. example

var setname = 'set_1', elements = {};
elements[setname] = ['beer','water','wine'];
alert(elements['set_1']);

Now how do i dynamically add more elements to set_1 key? like to extend the set_1 with coffee tea.

Sorry if this question has been repeated and is very trivial, i did my search. I found one article realted to it,how to assign variable value as variable name in a hash?

  • 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-28T03:58:27+00:00Added an answer on May 28, 2026 at 3:58 am

    Here, elements['set_1'] is just a normal Javascript array. The fact that it is a property of the elements object is completely immaterial to how it behaves. You can add items to it in the normal Javascript way: with push:

    elements['set_1'].push('coffee');
    elements['set_1'].push('tea');
    

    If you don’t know what the property’s name will be when you write your code, you can do exactly the same with a variable:

    elements[setname].push('coffee');
    elements[setname].push('tea');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to web service stuff so please be kind. I have
I'm finding this kind of overriding after a new in java code very often
I am very very new to the iPhone programming. I am kind of playing
I am very new to Javascript and Jquery, so my apologies for this beginner's
We are starting a new project and we have decided to use javascript namespaces
I am very new to both node and Javascript, and am completely lost when
I am not new to programming, but kind of rusty in Javascript/web development. I
I am very new to creating webservers - and I have had several goes
I am very new with Python and I have just received this message while
So I am very new to using jQuery and I have a script that

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.