squares js solution