decomposition of js code