Fitting js code 2