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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:28:20+00:00 2026-06-11T11:28:20+00:00

My code : var listaIDOrdine = new Array(); for (i = 0; i <

  • 0

My code :

var listaIDOrdine = new Array();
for (i = 0; i < 10; i++) {
    listaIDOrdine[i] == new CoppiaIDOrdine(1, 1);
    console.log(listaIDOrdine[i]);
}

function CoppiaIDOrdine(id, ordine) {
    this.id = id;
    this.id = ordine;
}

but I get 10 undefined! What is wrong? I expect to have the “couple” of item at every console.log().

Also tried with console.log(listaIDOrdine[i].id); but seems that id is undefined?

  • 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-11T11:28:21+00:00Added an answer on June 11, 2026 at 11:28 am

    You are using == (comparison operator) when you should be using = (assignment operator):

    listaIDOrdine[i] = new CoppiaIDOrdine(1, 1);
    

    Also, you could use Array#push instead to add elements to the array:

    listaIDOrdine.push(new CoppiaIDOrdine(1, 1));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this code: var reg = /a/g; console.log(reg.test(a)); console.log(reg.test(a)); I get this result: true
Checking the simple code var http = require('http'); var server = http.createServer(function(req, res){ console.log(Got
Javascript Code var d = function c() { console.log(c); }; d(); // function c()
The Code: var i=0,j=0; var t1= new Array(); function createtext(){ i++; t1[i]=document.createElement('input'); t1[i].type='text'; t1[i].name='text'+i;
This code var offset = $('#snapwrap_inner').offset(); alert(offset.left) in FF returns 0px but in Opera
This is my code: var boo = new RegExp(\\Bis\\B,gi); var result = boo.exec(this AisA
I have the code var expired_overlay=$('.expired-overlay'); expired_overlay.each(function(){ var t=$(this), p=$(this).closest('.coupon'), ph=p.height()+ ((p.css('padding-top').replace(px, ))*2); t.css({'width':p.width(),'height':ph,'opacity':0.5})
Code: var a={ value:5, test:function() { this.value=4; } } var b=someFunction( { value:5, test:function()
Example code: var connection = null; function onConnect(status) { im_a_big_error.log('wtf'); // Why it doesn't
This code: var customers = from cust in Customers group cust by new {cust.Country}

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.