this is my daughters homework she asked me to help and now im stuck she has worked it out and is making me look stupid need to get my selfrespect back even if i have to cheat(i used my brain and im asking you) the code is as follows but i cannot get it to work


var plantHeights = [15,16,17,18,19];
var plantNumbers = [2,1,6,4,2];
var product = new Array(5);

for (var count = 1; count <= productArray; count = count + 1)
{
product = plantHeights * plantNumbers;
}
document.write( product);
i cannot get the product to write out the plantHeights * plantNumbers and store them in a new array can anybody help

Recommended Answers

All 3 Replies

I don't believe this is c\c++

Edit: that loop is pointless....

this is my daughters homework she asked me to help and now im stuck she has worked it out and is making me look stupid need to get my selfrespect back even if i have to cheat(i used my brain and im asking you) the code is as follows but i cannot get it to work


var plantHeights = [15,16,17,18,19];
var plantNumbers = [2,1,6,4,2];
var product = new Array(5);

for (var count = 1; count <= productArray; count = count + 1)
{
product = plantHeights * plantNumbers;
}
document.write( product);
i cannot get the product to write out the plantHeights * plantNumbers and store them in a new array can anybody help

your code looks like javascript, so this is the wrong place to post (just my opinion) still maybe this can help :

<script type="text/javascript">

var plantHeights = [15,16,17,18,19];
var plantNumbers = [2,1,6,4,2];
var product = new Array(5); 

var count = 0;
for (count = 0; count < 5; count = count + 1)
{
   product[count] = plantHeights[count] * plantNumbers[count];
}

var i=0;
for (i = 0; i < 5; i++)
{
    document.write(product[i]);
}

</script>

this is my daughters homework she asked me to help and now im stuck she has worked it out and is making me look stupid need to get my selfrespect back even if i have to cheat(i used my brain and im asking you) the code is as follows but i cannot get it to work

IMO, you'll get more respect from her (which is more important than your own) by admitting she's better and having her teach you. It'll do wonders for her self esteem, which is sadly lacking in people now-a-days. And you'll feel better knowing you gave her a great ego boost.

By the way, no one can make you feel stupid. Only you can do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.