I need to make some "programs" in JavaScript...

1. A program that "calculates" a person age.
2. A program that "write" the first 50 multiples of 3.

Also..........

How can i know if a string is a text or a numeric one?
How can i "write" text a document already loaded?

Thanks