Getting idea of js functions