function priority changes in js