I don't know how javascript scope works