Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I go from codecademy to actual programming? Specific example included
    text
    copied!<p>So I have been spending a lot of time lately on codecademy and it is amazing. I feel like I am starting to really grasp JavaScript and programming in general. However, I want to start the basics of implementing my new skills into use. I am sure I am not alone with this desire and while I have some books coming in the mail (for jQuery, Ajax and Ruby) I thought Stack Overflow might be a good place to start.</p> <p>Let's say for example I wanted to use the code (or something like it) below that I just wrote to calculate someones BMI and interpret it for them. It prompts them to input their weight and height and then calculates their BMI.</p> <p>The code works in the codecademy scratch pad but I would have no idea how to put this code to use in the real world. I have a feeling it would have something to do with creating an HTML form and taking the input names as variables but I'm not sure.</p> <p>If this isn't the correct place to ask the question, I apologize, this is my first question on Stack Overflow! </p> <pre><code>var weight = prompt("How much do you weigh, in pounds?"); var height = prompt("How tall are you, in inches?"); var BMI = (weight*703)/(height*height); console.log("You have a BMI of " + Math.floor(BMI)); if (BMI&lt;=15){ console.log("You are very severly underweight!"); }else if (BMI&lt;16 &amp;&amp; BMI&gt;=15){ console.log("You are severly underweight!"); }else if (BMI&lt;19 &amp;&amp; BMI&gt;=16){ console.log("You are underweight"); }else if (BMI&lt;25 &amp;&amp; BMI&gt;=19){ console.log("You are healthy!"); }else if(BMI&lt;30 &amp;&amp; BMI &gt;=25){ console.log("You are overweight" ); }else if(BMI&lt;35 &amp;&amp; BMI &gt;=30){ console.log("You are moderately obese!"); }else{ console.log("lose weight fatty!"); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload