What are your chances of winning the lottery?
Suppose a lottery game picks 6 distinct numbers from the set 1..53. What are the odds that your 6 numbers come up?
In a separate browser window, navigate to javascript.cs.lmu.edu/runner and enter the following code into the text box and hit the Run button.
var possibilities = 53 * 52 * 51 * 50 * 49 * 48;
alert("The odds are " + possibilities + " to 1.");
If it works, a window should have popped up with the message "The odds are 16529385600 to 1." If you
are having a hard time reading that number, the JavaScript language has this nice toLocaleString
operator you can apply to numbers. Edit your program so it reads like this:
var possibilities = 53 * 52 * 51 * 50 * 49 * 48;
alert("The odds are " + possibilities.toLocaleString() + " to 1.");
and run it again. You should see a number nicely formatted according to the locale that your computer is configured for.
We can specify the locale directly. Try this:
var possibilities = 53 * 52 * 51 * 50 * 49 * 48;
alert("The odds are " + possibilities.toLocaleString("de-DE") + " to 1.");
ar-EG. Also try en-US.
There are many tutorials, walkthroughs, academies, and online universities out on the web that will teach you the basics of programming. You can try:
Khan Academy Computer Science is a pretty good place to start.
Go to Khan Acedemy's Computer Science home page. Then:
Khan Academy provides a nice little environment using the Ace Editor and a Code Canvas. You write code in the JavaScript programming language (with Processing.js to generate the graphics) and the canvas is updated as you write your code! The editor features nice little gadgets (e.g., the number picker and the color picker) to vary program elements via gestures for instant feedback and to encourage experimentation.
There are dozens of scripts for you to use as a starting point. If you want to start simply, choose one of the programs from the Drawing group, for example Winston or Snowman. Use the number picker in the editor to play around and see what each of the values are doing. Change the program into something you like better, and save it or share it (using the Save As... or Share buttons under the canvas).
Feeling good about yourself now? Try the New Program button to the upper right of the code canvas. Remember what you've learned:
ellipse, rect, line, triangle,
point, and bezier.
stroke to set the stroke color and fill to set the fill color for subsequent
drawing; turn them off with noStroke and noFill.
translate, rotate, and scale to affect subsequent drawing; turn
these "off" with resetMatrix.
draw function. The properties you want to animate
will have to be defined in variables outside the function, then assigned new values within the function. You
can "animate" literally anything, not just sizes, positions, and colors. Be creative!
Here's something I made:

The programming culture is one of sharing. Programmers are generally flattered when others use their code and extend it in new ways.
If you've made a modification to an existing program, share it. Remember to give attribution to the original author. Fortunately, Khan Academy makes this easy. If you've started with someone else's code and saved a "derived work" into your own "My Programs" bucket, then your program's page will show, to the lower right of the code, a link to the original program.
While there's likely no one best way for everyone to learn programming, Khan Academy Computer Science has some fans, but it's not completely without fault.
Please read (and interact with) this excellent essay by Bret Victor.