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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:53:19+00:00 2026-06-17T20:53:19+00:00

Hi I am new to javascript. I want to get the index of array

  • 0

Hi I am new to javascript. I want to get the index of array using its value and append new element into that array. Here is my array:

var testArray=[];

testArray.push({"key1":"value1","key2":"value2"});
testArray.push({"key1":"value11","key2":"value22"});

Now I want to get the index of “value11” and also append new element as “key3″:”value33” in the same index as below:

testArray.push({"key1":"value11","key2":"value22","key3":"value33"});

Please explain. Thanks in advance…

  • 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-17T20:53:21+00:00Added an answer on June 17, 2026 at 8:53 pm
    var testArray=[];
    
    testArray.push({"key1":"value1","key2":"value2"});
    testArray.push({"key1":"value11","key2":"value22"});
    
    var filtered = testArray.filter(function(item) {
        if (item.key1 == 'value11') {
            item.key3 = 'value33';
            return true
        }
        return false;
    });
    

    http://jsfiddle.net/XUzJw/

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

Sidebar

Related Questions

I have an array and simply want to get the element at index 1.
I'm brand spankin' new to Javascript. Here's what I want to do. I want
An example: getAppletContext().showDocument( new URL(javascript:alert(document.getElementById('textbox').value); )); Instead of alerting this textbox value, I want
I m new to using Web services using JavaScript. All I want is to
I am new to javascript.I want to move a car on path with arrows.I
I am new to Javascript and am having some difficulty. I want to have
If I want to try out something new in Ruby or Javascript, I love
I want it to have a popup dialog javascript box. Instead of a new
I am new in share point. I want to select data using java script
I'm still quite new to javascript and JQuery...How do I get this div to

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.