js method and learning