Logical Questions based on javascript