Growtopia Cutway Massproducing calculator


#1

Hello!
I am totaly sure, that some of You know Growtopia! So first I made this for my own personal needs, but then I was like "Oh, wait. This might be usefull for someone else!". So here it is - Cutway Massproducing calculator made in JavaScript. Please tell me what can I improve!
Code:

 var cutwayTrees = prompt("How many cutway trees would You like to make?");
 var seedCount = [4,1,2,2];
 var seedNames = ["door","sand","window","garbage"];
 console.log("You'll need:")
 for (var i = 0; i < 4; i ++) {
   console.log(" " + seedCount[i]*cutwayTrees + " " + seedNames[i])
 }
 console.log("seeds to make " + cutwayTrees + " cutway trees.")

#2

@thekristux,

The prompt() method will return a string Value
and as you are using the outcome for calculations
you might want to convert the string Value to a number Value
using the parseInt() method
like

var cutwayTrees = 
   parseInt(prompt("How many cutway trees would You like to make?"),10);

Reference

google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript [your question] site:stackoverflow.com

== guidance ==
www.crockford.com
http://javascript.crockford.com/code.html
http://javascript.crockford.com/survey.html
http://stackoverflow.com/questions/9549780/what-does-this-symbol-mean-in-javascript
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
www.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide