basic function to hot cold javascript