solutions to interview questions in javascript