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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:55:48+00:00 2026-05-15T18:55:48+00:00

This is trivial I know but I’m so used to OOP languages. I’m trying

  • 0

This is trivial I know but I’m so used to OOP languages. I’m trying to figure out how to write out each name/value in either one alert or many, just so I can verify the data

var dCookieNameValuePairs = {};

for (i = 0; i < cookieValues.length; i++)
{
    var akeyValuePair = aCookieValues[i].split("=");
    dCookieNameValuePairs[keyValuePair[0]] = keyValuePair[1];
}

// display each name value pair testing
for (i = 0; i < dCookieNameValuePairs.length; i++)
{
    alert("Name: " + dCookieNameValuePairs[] + "Value: " + 
}

I’m stuck at the second for loop…I am not sure how to iterate through the dictionary and then focus on each name/value to spit it back.

  • 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-15T18:55:50+00:00Added an answer on May 15, 2026 at 6:55 pm

    You want to use for..in for enumerating through a dictionary/map.

    for ( var prop in dCookieNameValuePairs ) {
       if ( dCookieNameValuePairs.hasOwnProperty( prop ) ) {
           alert( dCookieNameValuePairs[prop] )
       }
    }
    

    I may have typo’d. Only use .length when you are dealing with an array [] or a custom array-like object that you defined to have .length populated.

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

Sidebar

Related Questions

i know this sounds really common and so trivial but , am having a
So here's what I am trying to do(trivial, I know; I am doing this
I know that this sounds trivial, but I did not realize that the sort()
Is this correct? int (*(*ptr)())[]; I know this is trivial, but I was looking
I don't know if this question is trivial or not. But after a couple
This must be trivial I know, but I've been tryin for so long to
I know this sounds pretty trivial, but I'm new to jQuery... I use this
I know this is very trivial , but i have installed J2Me .I just
Ok I know that this is trivial question but: How can i remove lines
I know this is trivial, but it doesn't make sense to me. Java can't

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.