added index.js, fill in the pseudocode in index.js