This page has a bunch of problem statements which describe programs that you can implement for the joy of practicing your craft. Remember that when you implement them, several things should happen; DON'T JUST JUMP INTO THE CODE RIGHT AWAY unless the problem is so trivial that you can do it in a line or two of code.
isSmallInteger() which returns
true if its sole parameter is an integer between -128 and 127, inclusive, and
false otherwise.
Examples:sumOfCodepoints which takes a string
and returns the sum of each of the codepoints in the string. Hint: The method you are looking
for is charCodeAt. We covered code points in chapter 3 - review if you need to do so.
var x = 1;
var f = function (y) {alert(x + y);}
f(2);
split("") to turn a string into an array of characters to which
you can apply the filter.
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
HOTEL
ECHO
LIMA
LIMA
OSCAR
....and the phrase "blah blah" will produce:
bravo
lima
alpha
hotel
bravo
lima
alpha
hotel
There is no distinction required for upper or lower case letters, so you may treat them however you
want. For a complete listing of the NATO alphabet, see the web page at:
http://en.wikipedia.org/wiki/NATO_phonetic_alphabet
***
~~~
***
A listing of the Morse code is on the same page as the wikipedia link above.
Hours: 0 0 1 1 0 0
Minutes: 1 0 0 0 1 0
Seconds: 1 1 1 0 0 0
Don't forget error checking the input values. You can decide for yourself whether to accept military
time formats (i.e., "13:24:35" is 24 minutes and 35 seconds past 1 PM).
"a" -> "aRbFR"
"b" -> "LFaLb"
Thus for D0 = "Fa", we get D1 = "FaRbFR" and D2 = "FaRbFRRLFaLbFR". This process is known as grammar
production in some circles.
D3 -> "FaRbFRRLFaLbFRRLFaRbFRLLFaLbFR"
"R" count = 7
2, 3, 5, 7, 11, 13, 17, 19 .....which has the sum 77
What is the output for the 15th prime number? The 23rd? What is the sum of the first 37 primes?
You may wish to write a "helper" function to determine if a number is prime (if you haven't already
done so!).