ruby and node.js rewrite for first 2 exercises