Reflect on the interview: Questions asked. Presentation. How he/she answered. Did he or she ask for specific feedback afterwards? It could be the company was just looking for someone more senior, or that he/she fell short because of specific skills sought after that he/she did not present while other contenders for the position did.
I would say: 1) learn from your own mistakes; identify and be realistic about strengths and weaknesses; 2) learn from the mistakes of others; e.g. Look at interview questions on popular websites and read blogs and sites like hashnode (for example); 3) study to fill your gap... ask a friend to help 4) pick yourself up and try again