n-queen problem implemented in javascript