various classic code problems solved in javascript