perfect Javascript