outline steps to the function in js comments: