exercise 4 for ruby and node.js